<div dir="ltr"><div><div>I am writing a compiler using LLVM 3.2 as the back end.<br><br></div>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:<br><span style="font-size:100%;font-family:arial,sans,sans-serif;font-weight:normal;font-style:normal;text-decoration:none;color:rgb(0,0,0);text-align:right"><br>/tools/llvm/3.2na/bin/opt test.bc -O2  -time-passes -o opt.bc<br>reports: 119s (71%) in DSE<br></span><br></div>Bug 15000 reports a performance issue with DSE. The bug is marked fixed, so I decided to try using LLVM 3.5.1:<br><br>/tools/llvm/3.5.1rel/bin/opt test.bc -O2  -time-passes -o opt.bc<br><br><div>  Total Execution Time: 151.3811 seconds (151.4667 wall clock)<br><br>   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---<br>  98.8245 ( 65.3%)   0.0000 (  0.0%)  98.8245 ( 65.3%)  98.9236 ( 65.3%)  Dead Store Elimination<br><br>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?<br><br></div><div>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.<br></div><div><br><br></div></div>