[PATCH] D15537: limit the number of instructions per block examined by dead store elimination

Bob Haarman via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 12:49:05 PDT 2016


Thanks for your clarifications, David. Yes, the patch keeps track of how 
many instructions we have already looked at in MDA and limits us to 
examine up to the limit configured for that. Without the patch, it is 
possible to trick DSE into examining memdep-block-scan-limit 
instructions an unbounded number of times, effectively bypassing that 
limit. As such, this can be considered to fix a bug in the enforcement 
of an existing limit more than the introduction of a limit that did not 
previously exist.

I also want to clarify that this will not make DSE much less aggressive. 
It will only change the outcome of DSE in cases where (1) there are no 
MDA results within 100 instructions that allow us to conclusively 
determine whether or not we can perform DSE, (2) there is an MDA result 
within 100 instructions that is reported back to the DSE pass, which 
causes the DSA pass to call back into MDA again, and (3) there is a MDA 
result beyond 100 instructions from where the search started that allows 
us to perform DSE. If all these conditions are met (I am not aware of 
any code that triggers this scenario, but such code could be written), 
the patch ends up not performing a DSE that could have been performed, 
whereas the original code would have performed that DSE. However, note 
that this is similar to the scenario where there is no MDA result within 
100 instructions that causes us to call back into the MDA pass, in which 
case we already accept missing out on that optimization without the 
patch I proposed.

I will be working on updating the patch to apply against current master. 
Is there anything else I need to do to get this accepted?




More information about the llvm-commits mailing list