[llvm-commits] CVS: llvm/include/llvm/Constants.h

Reid Spencer reid at x10sys.com
Sat Dec 16 22:07:45 PST 2006



Changes in directory llvm/include/llvm:

Constants.h updated: 1.107 -> 1.108
---
Log message:

Fix problems in the CBE and InstructionCombining which use the isMaxValue
and isMinValue methods of ConstantInt. These have been broken since the
isSigned parameter was added. It is necessary to use the signed version
of the type in the call to isValueValidForType or else incorrect results
are returned.


---
Diffs of the changes:  (+2 -2)

 Constants.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.107 llvm/include/llvm/Constants.h:1.108
--- llvm/include/llvm/Constants.h:1.107	Tue Dec 12 17:36:14 2006
+++ llvm/include/llvm/Constants.h	Sun Dec 17 00:07:30 2006
@@ -205,7 +205,7 @@
       int64_t V = getSExtValue();
       if (V < 0) return false;    // Be careful about wrap-around on 'long's
       ++V;
-      return !isValueValidForType(getType(), V) || V < 0;
+      return !isValueValidForType(getType()->getSignedVersion(), V) || V < 0;
     }
     return isAllOnesValue();
   }
@@ -219,7 +219,7 @@
       int64_t V = getSExtValue();
       if (V > 0) return false;    // Be careful about wrap-around on 'long's
       --V;
-      return !isValueValidForType(getType(), V) || V > 0;
+      return !isValueValidForType(getType()->getSignedVersion(), V) || V > 0;
     }
     return getZExtValue() == 0;
   }






More information about the llvm-commits mailing list