Skip to content

compiler crash only with -O1  #66

@wheatman

Description

@wheatman

It does not crash with any of O0, O2, Os, or O3, but crashes with O1
The specific assertion error is
clang-10: /home/neboat/opencilk/llvm/lib/Transforms/Tapir/TapirLoopInfo.cpp:425: llvm::Value *llvm::TapirLoopInfo::getOrCreateTripCount(llvm::PredicatedScalarEvolution &, const char *, llvm::OptimizationRemarkEmitter *): Assertion `L->isLoopInvariant(ConditionEnd) && "Condition end is not loop invariant."' failed.

The version I am using is
clang version 10.0.1 ([email protected]:OpenCilk/opencilk-project.git 8435006)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/ubuntu/OpenCilk-10.0.1-Linux/bin

The full back-trace is:

clang-10: /home/neboat/opencilk/llvm/lib/Transforms/Tapir/TapirLoopInfo.cpp:425: llvm::Value *llvm::TapirLoopInfo::getOrCreateTripCount(llvm::PredicatedScalarEvolution &, const char *, llvm::OptimizationRemarkEmitter *): Assertion `L->isLoopInvariant(ConditionEnd) && "Condition end is not loop invariant."' failed.
Stack dump:
0. Program arguments: /home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name test.cpp -mrelocation-model static -mthread-model posix -mframe-pointer=none -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu cascadelake -target-feature +sse2 -target-feature +cx16 -target-feature +sahf -target-feature -tbm -target-feature -avx512ifma -target-feature -sha -target-feature -gfni -target-feature -fma4 -target-feature -vpclmulqdq -target-feature +prfchw -target-feature +bmi2 -target-feature -cldemote -target-feature +fsgsbase -target-feature -ptwrite -target-feature +xsavec -target-feature +popcnt -target-feature +aes -target-feature -avx512bitalg -target-feature -movdiri -target-feature +xsaves -target-feature -avx512er -target-feature +avx512vnni -target-feature -avx512vpopcntdq -target-feature -pconfig -target-feature +clwb -target-feature +avx512f -target-feature -clzero -target-feature +pku -target-feature +mmx -target-feature -lwp -target-feature -rdpid -target-feature -xop -target-feature +rdseed -target-feature -waitpkg -target-feature -movdir64b -target-feature -sse4a -target-feature +avx512bw -target-feature +clflushopt -target-feature +xsave -target-feature -avx512vbmi2 -target-feature +64bit -target-feature +avx512vl -target-feature +invpcid -target-feature +avx512cd -target-feature +avx -target-feature -vaes -target-feature +cx8 -target-feature +fma -target-feature -rtm -target-feature +bmi -target-feature -enqcmd -target-feature +rdrnd -target-feature -mwaitx -target-feature +sse4.1 -target-feature +sse4.2 -target-feature +avx2 -target-feature +fxsr -target-feature -wbnoinvd -target-feature +sse -target-feature +lzcnt -target-feature +pclmul -target-feature -prefetchwt1 -target-feature +f16c -target-feature +ssse3 -target-feature -sgx -target-feature -shstk -target-feature +cmov -target-feature -avx512vbmi -target-feature -avx512bf16 -target-feature +movbe -target-feature +xsaveopt -target-feature +avx512dq -target-feature +adx -target-feature -avx512pf -target-feature +sse3 -dwarf-column-info -fno-split-dwarf-inlining -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -resource-dir /home/ubuntu/OpenCilk-10.0.1-Linux/lib/clang/10.0.1 -D NDEBUG -D ENABLE_TRACE_TIMER=0 -D CYCLE_TIMER=0 -D CILK=1 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/backward -internal-isystem /usr/local/include -internal-isystem /home/ubuntu/OpenCilk-10.0.1-Linux/lib/clang/10.0.1/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O1 -Wall -Wextra -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/ubuntu/PMA -ferror-limit 19 -fmessage-length 0 -fopencilk -mllvm -use-opencilk-runtime-bc=true -mllvm -opencilk-runtime-bc-path=/home/ubuntu/OpenCilk-10.0.1-Linux/lib/clang/10.0.1/lib/x86_64-unknown-linux-gnu/libopencilk-abi.bc -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o /tmp/test-fdeadd.o -x c++ test.cpp

  1.  <eof> parser at end of file
    
  2.  Per-module optimization passes
    
  3.  Running pass 'Function Pass Manager' on module 'test.cpp'.
    
  4.  Running pass 'Loop Spawning with Task Info' on function '@_ZNK4CPMAI17uncompressed_leafIjEE3sumEv'
    

#0 0x0000000004813454 PrintStackTraceSignalHandler(void*) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4813454)
#1 0x00000000048110fe llvm::sys::RunSignalHandlers() (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x48110fe)
#2 0x0000000004813865 SignalHandler(int) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4813865)
#3 0x00007f5a97e793c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#4 0x00007f5a9636d18b raise /build/glibc-eX1tMB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007f5a9634c859 abort /build/glibc-eX1tMB/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007f5a9634c729 get_sysdep_segment_value /build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007f5a9634c729 _nl_load_domain /build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007f5a9635df36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
#9 0x00000000058da4d0 llvm::TapirLoopInfo::getOrCreateTripCount(llvm::PredicatedScalarEvolution&, char const*, llvm::OptimizationRemarkEmitter*) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x58da4d0)
#10 0x00000000058da6b1 llvm::TapirLoopInfo::prepareForOutlining(llvm::DominatorTree&, llvm::LoopInfo&, llvm::TaskInfo&, llvm::PredicatedScalarEvolution&, llvm::AssumptionCache&, char const*, llvm::OptimizationRemarkEmitter&, llvm::TargetTransformInfo const&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x58da6b1)
#11 0x000000000588417f (anonymous namespace)::LoopSpawningImpl::outlineAllTapirLoops() (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x588417f)
#12 0x0000000005882c42 (anonymous namespace)::LoopSpawningImpl::run() (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x5882c42)
#13 0x0000000005892163 (anonymous namespace)::LoopSpawningTI::runOnFunction(llvm::Function&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x5892163)
#14 0x000000000412fabc llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x412fabc)
#15 0x000000000412fd98 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x412fd98)
#16 0x00000000041304a0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x41304a0)
#17 0x0000000004a0ea6b clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4a0ea6b)
#18 0x000000000519da15 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x519da15)
#19 0x0000000005fb74a3 clang::ParseAST(clang::Sema&, bool, bool) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x5fb74a3)
#20 0x00000000050ebd40 clang::FrontendAction::Execute() (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x50ebd40)
#21 0x0000000005048ad3 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x5048ad3)
#22 0x0000000005198130 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x5198130)
#23 0x0000000002b7e21d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x2b7e21d)
#24 0x0000000002b7c1ec ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x2b7c1ec)
#25 0x0000000002b7bebb main (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x2b7bebb)
#26 0x00007f5a9634e0b3 __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
#27 0x0000000002b78fce _start (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x2b78fce)
clang-10: error: unable to execute command: Aborted (core dumped)
clang-10: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 10.0.1 ([email protected]:OpenCilk/opencilk-project.git 8435006)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/ubuntu/OpenCilk-10.0.1-Linux/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to https://github.com/OpenCilk/opencilk-project/issues and include the crash backtrace, preprocessed source, and associated run script.
clang-10: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/test-7dc08b.cpp
clang-10: note: diagnostic msg: /tmp/test-7dc08b.sh
clang-10: note: diagnostic msg:

test-7dc08b.sh.txt
test-7dc08b.cpp.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions