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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 17 09:35:33 PDT 2019


spatel added reviewers: lebedev.ri, nikic.
spatel added a comment.

Please check in the test that provides the missing coverage as an NFC preliminary patch.

I agree with all of the comments about the min/max hacks here, and I wish we could untangle this, but it's tough to do without breaking something along the way.

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?
https://rise4fun.com/Alive/dOr

  %i2 = icmp sgt i32 %i, 1
  %i3 = select i1 %i2, i32 %i, i32 1
  %i4 = icmp sgt i32 %i3, 0
  =>
  %i4 = true


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