[PATCH] D68128: [InstCombine] Fold PHIs with equal incoming pointers

Daniil Suchkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 00:30:19 PDT 2019


DaniilSuchkov added a comment.

In D68128#1709717 <https://reviews.llvm.org/D68128#1709717>, @spatel wrote:

> I didn't step through the entire patch/tests, but the first few examples are flattened/simplified by -simplifycfg. Would it be better to look there to add the missing functionality? Is there a test in this patch that shows a case that simplifycfg can't already flatten?


SimplifyCFG happens to flatten most of these tests by a transformation that performs hoisting of the common code from the branches to their only immediate predecessor and does only very primitive matching, and, according to comments around it, this transformation is intentionally cheap and simple. So, such an extension of simplifycfg would perform worse on all cases other than primitive tests and it's not exactly in line with the intentions behind the transformation.

The tests from D68263 <https://reviews.llvm.org/D68263> are bad at showing when this transformation is more powerful than what SimplifyCFG can do because it wasn't the intention. Out of all the tests, following are out of scope of the SimplifyCFG transform and thus not simplified: test_extra_uses_multiple_geps, test_gep_and_bitcast_same_bb_and_extra_use, test_gep_and_bitcast_same_bb.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68128/new/

https://reviews.llvm.org/D68128





More information about the llvm-commits mailing list