+llvm-dev [usually it is best to CC the llvm dev list for these kinds
Also +David Majnemer for InstCombine.
This looks like an LLVM bug to me if it reproduces on top of tree.
Can you dump out the IR input to InstCombine so that we can reproduce
the infinite loop with `opt -instcombine < bug.ll`? If yes, that
would be a pretty reasonable bug report.
If you're able to reproduce the infinite loop with -O3 then you should
be able to dump out the IR that causes `opt -instcombine` to infloop,
unless the bug is truly esoteric (e.g. only caused by a specific
use-list ordering). Maybe take a closer look at the output from `opt
Alternatively you can use bugpoint to minimize the IR to get a small
reproducer that causes `opt -O3` to hang:
Thank you for your guide.
I dumped last IR (input IR to InstCombine pass) into “bug.ll” file by using
opt -print-before-all -O3.
I also created bc file using
-emit-llvm -O1 -Xclang -disable-llvm-passes -c.
- you can reproduce the infinite loop by using
opt -O2 -instcombine < bug.bc.
I attached these files into this email and please let me know if you need more files and information.
bug.bc (182 KB)
bug.ll (26.8 KB)
I’ll try to fix this is nobody else has yet. I suspect it’s similar to:
…constant expressions get grouped in with regular constants in our pattern matching and cause trouble.