[llvm-commits] [llvm] r128028 - /llvm/trunk/lib/Analysis/ValueTracking.cpp
Nick Lewycky
nicholas at mxc.ca
Mon Mar 21 14:40:32 PDT 2011
Author: nicholas
Date: Mon Mar 21 16:40:32 2011
New Revision: 128028
URL: http://llvm.org/viewvc/llvm-project?rev=128028&view=rev
Log:
Fix INT_MIN gotcha pointed out by Eli Friedman.
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=128028&r1=128027&r2=128028&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Mon Mar 21 16:40:32 2011
@@ -725,9 +725,10 @@
isPowerOfTwo(SI->getFalseValue(), TD, Depth);
// An exact divide or right shift can only shift off zero bits, so the result
- // is a power of two only if the first operand is a power of two.
- if (match(V, m_Shr(m_Value(), m_Value())) ||
- match(V, m_IDiv(m_Value(), m_Value()))) {
+ // is a power of two only if the first operand is a power of two and not
+ // copying a sign bit (sdiv int_min, 2).
+ if (match(V, m_LShr(m_Value(), m_Value())) ||
+ match(V, m_UDiv(m_Value(), m_Value()))) {
BinaryOperator *BO = cast<BinaryOperator>(V);
if (BO->isExact())
return isPowerOfTwo(BO->getOperand(0), TD, Depth);
More information about the llvm-commits
mailing list