[PATCH] D45065: [InstCombine] Fix PR17564: don't fold [zs]ext into phi.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 2 06:31:02 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D45065#1054271, @spatel wrote:

> Avoiding instcombine folds is fragile. There's no guarantee that the IR isn't already in the form we're trying to avoid when we start instcombine, so we would fail to optimize in that case.


Yes, i understand.

> Also, some of the tests show the benefit of the existing transform - we eliminate an instruction by changing the type of the phi.

Uhm, which one specifically? As far as i can see, all tests here end up with the same instructions, just some are moved around.
But in `@icmp_div2` we actually loose an instruction, and always return 1.

> I think we should solve this using something like https://reviews.llvm.org/D45108 instead



> but I need to look closer at how the case in the bug report escaped the matching that we already have in foldSelectInstWithICmp() and foldSelectICmpAnd().

Hmm, right, somehow i missed those when looking where to work on https://reviews.llvm.org/D45108

So, i should close this?


Repository:
  rL LLVM

https://reviews.llvm.org/D45065





More information about the llvm-commits mailing list