[llvm] [DFAJumpThreading] Rewrite the way paths are enumerated (PR #96127)
Mikael Holmén via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 21 23:11:51 PDT 2024
mikaelholmen wrote:
Hi @UsmanNadeem
The following starts crashing with this patch:
```
opt "-passes=dfa-jump-threading" bbi-98332.ll -o /dev/null
```
It hits an assert like
```
opt: ../include/llvm/IR/Instructions.h:2679: llvm::Value *llvm::PHINode::getIncomingValueForBlock(const llvm::BasicBlock *) const: Assertion `Idx >= 0 && "Invalid basic block argument!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: build-all/bin/opt -passes=dfa-jump-threading bbi-98332.ll -o /dev/null
1. Running pass "function(dfa-jump-threading)" on module "bbi-98332.ll"
2. Running pass "dfa-jump-threading" on function "func_17"
#0 0x00005608ae38fc27 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (build-all/bin/opt+0x4142c27)
#1 0x00005608ae38d70e llvm::sys::RunSignalHandlers() (build-all/bin/opt+0x414070e)
#2 0x00005608ae39062f SignalHandler(int) Signals.cpp:0:0
#3 0x00007f377811ccf0 __restore_rt (/lib64/libpthread.so.0+0x12cf0)
#4 0x00007f3775cd5acf raise (/lib64/libc.so.6+0x4eacf)
#5 0x00007f3775ca8ea5 abort (/lib64/libc.so.6+0x21ea5)
#6 0x00007f3775ca8d79 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d79)
#7 0x00007f3775cce426 (/lib64/libc.so.6+0x47426)
#8 0x00005608afa7b065 (anonymous namespace)::DFAJumpThreading::run(llvm::Function&) DFAJumpThreading.cpp:0:0
#9 0x00005608afa73f8c llvm::DFAJumpThreadingPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x5826f8c)
#10 0x00005608af70d9ed llvm::detail::PassModel<llvm::Function, llvm::DFAJumpThreadingPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilderPipelines.cpp:0:0
#11 0x00005608ae598cfa llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x434bcfa)
#12 0x00005608af70e41d llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilderPipelines.cpp:0:0
#13 0x00005608ae59d891 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x4350891)
#14 0x00005608af70793d llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) PassBuilderPipelines.cpp:0:0
#15 0x00005608ae59798a llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x434a98a)
#16 0x00005608af6b118b llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (build-all/bin/opt+0x546418b)
#17 0x00005608ae357c3d optMain (build-all/bin/opt+0x410ac3d)
#18 0x00007f3775cc1d85 __libc_start_main (/lib64/libc.so.6+0x3ad85)
#19 0x00005608ae3517ae _start (build-all/bin/opt+0x41047ae)
Abort (core dumped)
```
Maybe it's the dead basic block if.then449 that trips things over?
[bbi-98332.ll.gz](https://github.com/user-attachments/files/16706107/bbi-98332.ll.gz)
https://github.com/llvm/llvm-project/pull/96127
More information about the llvm-commits
mailing list