[PATCH] [Instcombine] Recognize test for overflow in integer multiplication.

Serge Pavlov sepavloff at gmail.com
Sun Mar 9 23:30:59 PDT 2014



================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2122
@@ +2121,3 @@
+  case ICmpInst::ICMP_ULT:
+    // Recognize pattern:
+    //   mulval = mul(zext A, zext B)
----------------
Akira Hatanaka wrote:
> If the comparison is ULT, shouldn't it check whether the constant operand is maxVal + 1 instead of maxVal? Otherwise, the result will be incorrect for a code like this:
> 
> if (a * b < 0xffffffff)
>   ...
Yes, you are right. In fact this is one more pattern of test for overflow at multiplication. Thank you!


http://llvm-reviews.chandlerc.com/D2814



More information about the llvm-commits mailing list