[PATCH] D17873: [InstCombine] (icmp sgt smin(PosA, B) 0) -> (icmp sgt B 0)

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 3 17:58:35 PST 2016


sanjoy requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:3180
@@ +3179,3 @@
+        SelectPatternResult SPR = matchSelectPattern(SI, A, B);
+        switch (SPR.Flavor) {
+        default: break;
----------------
Why not just use an `if` here?

================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:3183
@@ +3182,3 @@
+        case SPF_SMIN:
+          if (isKnownNonNegative(A, DL))
+            return new ICmpInst(I.getPredicate(), B, CI);
----------------
I think this needs to be `isKnownPositive`, since `(sgt (smin 0 1) 0)` == `false` but `(sgt 1 0)` == `true`.


http://reviews.llvm.org/D17873





More information about the llvm-commits mailing list