[PATCH] D12703: [InstCombine] Optimize icmp slt signum(x), 1 --> icmp sle x, 0.

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 15:21:23 PDT 2015


majnemer added inline comments.

================
Comment at: include/llvm/IR/PatternMatch.h:1281-1284
@@ +1280,6 @@
+    Type *Ty = V->getType();
+    if (!isa<IntegerType>(Ty))
+      return false;
+
+    unsigned ShiftWidth = cast<IntegerType>(Ty)->getBitWidth() - 1;
+    Value *OpL = nullptr, *OpR = nullptr;
----------------
Could you use `getScalarSizeInBits`? My thinking is that this would enable the transform to hack on vectors of integers.  The only caveat is that you need to fail if it gives you back zero, this could happen if its a vector of pointers.


http://reviews.llvm.org/D12703





More information about the llvm-commits mailing list