[PATCH] D59378: [InstCombine] Prevent icmp transform that can cause inf loop if part of min/max

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 07:48:22 PDT 2019


tejohnson added a comment.

In D59378#1432514 <https://reviews.llvm.org/D59378#1432514>, @nikic wrote:

> > I'd prefer that we IR simplify our way out of this infinite loop instead of looking the other way though. Ie, can we get this in instsimplify using a ConstantRange?
>
> That should be relatively simple to do, we just need to support constant range calculation for min/max flavor selects in computeConstantRange().


One thing I didn't mention is that this opportunity was exposed only by InstCombine's instruction sinking. I captured the code after sinking to create the test case.

Also, is it reasonable to assume prior passes will transform the code to avoid triggering possible infinite loops in later passes like this? Unless you mean move part of this transformation into InstSimplify and out of InstCombine? If that is a better longer term fix for these issues, it would be good if this one can go in for now to block the infinite loop.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D59378





More information about the llvm-commits mailing list