[PATCH] [Instcombine] Recognize test for overflow in integer multiplication.
Akira Hatanaka
ahatanak at gmail.com
Thu Mar 6 10:31:20 PST 2014
================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2122
@@ +2121,3 @@
+ case ICmpInst::ICMP_ULT:
+ // Recognize pattern:
+ // mulval = mul(zext A, zext B)
----------------
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)
...
http://llvm-reviews.chandlerc.com/D2814
More information about the llvm-commits
mailing list