[NewGVN] Assertion `BeforeCC->isEquivalentTo(AfterCC) && "Value number changed after main loop completed!"' failed.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Reproducer:
https://godbolt.org/z/6hjfex44e
Backtrace:
```console
opt: /root/llvm-project/llvm/lib/Transforms/Scalar/NewGVN.cpp:3318: void {anonymous}::NewGVN::verifyIterationSettled(llvm::Function&): Assertion `BeforeCC->isEquivalentTo(AfterCC) && "Value number changed after main loop completed!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=simplifycfg,loop-unroll,newgvn
1. Running pass "function(simplifycfg,loop-unroll,newgvn)" on module ""
2. Running pass "newgvn" on function "loop3"
#0 0x00000000008ff848 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8ff848)
#1 0x00000000008fc634 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8fc634)
#2 0x00000000008fc7ae SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x0000710ca8645330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#4 0x0000710ca869ec0c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9ec0c)
#5 0x0000710ca864527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#6 0x0000710ca86288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#7 0x0000710ca862881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
#8 0x0000710ca863b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#9 0x0000000004b3265b (anonymous namespace)::NewGVN::verifyIterationSettled(llvm::Function&) (.isra.0) NewGVN.cpp:0:0
#10 0x0000000004b33a99 (anonymous namespace)::NewGVN::runGVN() NewGVN.cpp:0:0
#11 0x0000000004b3564e llvm::NewGVNPass::run(llvm::Function&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4b3564e)
#12 0x00000000031c48fe llvm::detail::PassModel>::runImpl(llvm::detail::PassConcept>&, llvm::Function&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x31c48fe)
#13 0x0000000005ae9921 llvm::PassManager>::run(llvm::Function&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5ae9921)
#14 0x0000000000fc936e llvm::detail::PassModel>, llvm::AnalysisManager>::runImpl(llvm::detail::PassConcept>&, llvm::Function&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xfc936e)
#15 0x0000000005ae82ec llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5ae82ec)
#16 0x00000000009be94e llvm::detail::PassModel>::runImpl(llvm::detail::PassConcept>&, llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9be94e)
#17 0x0000000005ae7ade llvm::PassManager>::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5ae7ade)
#18 0x00000000009c842a llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef, llvm::ArrayRef>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9c842a)
#19 0x00000000009bca4b optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9bca4b)
#20 0x0000000000835a10 main (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x835a10)
#21 0x0000710ca862a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#22 0x0000710ca862a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#23 0x00000000008de6b5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8de6b5)
Program terminated with signal SIGABRT (6)
Compiler returned: 134
```
This comes from llvm/test/Analysis/MemorySSA/invariant-groups.ll
Contributor guide
Research direction
Start with the reproducer and the pass pipeline shown in the issue, then inspect llvm/lib/Transforms/Scalar/NewGVN.cpp around verifyIterationSettled. Review llvm/test/Analysis/MemorySSA/invariant-groups.ll and run the relevant opt pipeline. Done means the assertion no longer occurs and the regression remains covered by the test.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100