[PATCH] D44147: [InstCombine] Fold add/sub over phi node

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 6 14:02:29 PST 2018


dberlin added a comment.

This transform is a variation of some of the other phi of ops vs op of phi transforms we already do, just applied to a very limited case of expressions that would not normally be fully available, but where you've decide the cost is low.
It is also likely to screw up loop induction variables :)

None of these are fully redundant (because the expressions do not currently exist in the program in the places you have them), they are all partially redundant.
There is no need to special case it as you have in general, it just requires expression insertion. You are inserting them too, you are just repurposing part of an existing expression that you know will be dead.

The generalization is essentially what you get if you apply the phi-of-ops transform to PRE on top of NewGVN.

I doubt this should be done here because it's going to be hard to control the cost model or anything else here, and it's non-trivial to predict the effects.


https://reviews.llvm.org/D44147





More information about the llvm-commits mailing list