I am writing a compiler using LLVM 3.2 as the back end.
Given a certain (IMHO pathological, but otherwise representative of the things I will be expected to compile) input, LLVM is spending a lot of time in dead store elimination:
/tools/llvm/3.2na/bin/opt test.bc -O2 -time-passes -o opt.bc
reports: 119s (71%) in DSE
Bug 15000 reports a performance issue with DSE. The bug is marked fixed, so I decided to try using LLVM 3.5.1:
/tools/llvm/3.5.1rel/bin/opt test.bc -O2 -time-passes -o opt.bc
Total Execution Time: 151.3811 seconds (151.4667 wall clock)
—User Time— --System Time-- --User+System-- —Wall Time— — Name —
98.8245 ( 65.3%) 0.0000 ( 0.0%) 98.8245 ( 65.3%) 98.9236 ( 65.3%) Dead Store Elimination
I have no insight as to why DSE remains so poor. What constructs are particularly hard on DSE, which would result in what I’m seeing? Is there anything I can do? Is there an easy way for me to programmatically disable the DSE pass?
NOTE: by “programmatically”, I am looking for a way to disable DSE when using LLVM as a library. Passing command line options isn’t a very clean solution in that case.