This teaches instcombine to be able to remove PHI cycles which
only contain PHIs.
When a PHI doesn't have a non-PHI incoming value, we will now
try to resolve the PHI to each of the incoming values.
Differential D20174
[InstCombine] Allow removal of PHI cycles which only contain PHIs sbaranga on May 11 2016, 9:40 AM. Authored by
Details
Diff Detail Event Timeline
Comment Actions Only test incoming values if they dominate PN. Note that all incoming values need to be PHIs in order for us to do this test,
Comment Actions Any thoughts on the compile time impact of doing this in InstructionSimplify? Cheers,
|
Repeating this for each incoming value seems likely to be expensive. Can we do better? As one filter, we know that for the phi to be equal to some value, that value must dominate the phi or be a non-instruction value right? If so, can we use that?
Another option on how to approach this would be an inductive proof over the loop. On iteration 1, we know that %p2 = %p0 and thus that on every future iteration all inputes to the phis equal %p0. Framing this using a loop pass (possibly indvarsimplify?) might be another approach.
To be clear, I'm okay with the patch in it's current form if we can't find a better approach. I'm just asking to make sure we've explored all the options before eating the compile time.