The module pass pipeline includes a late LICM run after loop
unrolling.  LCSSA is implicitly run as a pass dependency of LICM.  However no
cleanup pass was run after this, so the LCSSA nodes ended in the optimized output.
Details
Diff Detail
Event Timeline
| lib/Transforms/IPO/PassManagerBuilder.cpp | ||
|---|---|---|
| 547 | InstCombine is expensive, do we have an alternative? What is the impact of not doing this cleanup here?  | |
| lib/Transforms/IPO/PassManagerBuilder.cpp | ||
|---|---|---|
| 547 | The LCSSA will end up in the optimized output. Two cases in which this was a problem for me: 
 
 I'm not sure whether this affects normal backends using SelectionDAG. At least I didn't find InstCombine in the llc pass pipeline.  | |
For reference: here is the bug report I filed recently: https://llvm.org/bugs/show_bug.cgi?id=27620
| lib/Transforms/IPO/PassManagerBuilder.cpp | ||
|---|---|---|
| 547 | Would InstSimplify work to get rid of these LCSSA PHI nodes?  | |
For reference: here is the bug report I filed recently: https://llvm.org/bugs/show_bug.cgi?id=27620
| lib/Transforms/IPO/PassManagerBuilder.cpp | ||
|---|---|---|
| 547 | You're right. I was sure I tried this before.  | |
| test/Other/cleanup-lcssa.ll | ||
|---|---|---|
| 14 | Are we running such tests usually?   | |
| test/Other/cleanup-lcssa.ll | ||
|---|---|---|
| 14 | I didn't find anything which was really comparable, but there are some tests that run opt -O3 .... test/Feature/OperandBundles/pr26510.ll even checks a whole function body.  | |
InstCombine is expensive, do we have an alternative? What is the impact of not doing this cleanup here?