[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp

Reid Spencer reid at x10sys.com
Sun Dec 31 13:43:45 PST 2006



Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.122 -> 1.123
---
Log message:

Fix a bug in comparison of GEP indices.


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

 ConstantFolding.cpp |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.122 llvm/lib/VMCore/ConstantFolding.cpp:1.123
--- llvm/lib/VMCore/ConstantFolding.cpp:1.122	Sat Dec 30 23:26:44 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp	Sun Dec 31 15:43:30 2006
@@ -299,7 +299,7 @@
         if (DestTy == Type::Int32Ty)
           return ConstantInt::get(DestTy, FloatToBits(FP->getValue()));
         assert(DestTy == Type::Int64Ty && 
-               "Incorrect integer  type for bitcast!");
+               "Incorrect integer type for bitcast!");
         return ConstantInt::get(DestTy, DoubleToBits(FP->getValue()));
       }
     }
@@ -705,8 +705,8 @@
 static int IdxCompare(Constant *C1, Constant *C2, const Type *ElTy) {
   if (C1 == C2) return 0;
 
-  // Ok, we found a different index.  Are either of the operands ConstantExprs?
-  // If so, we can't do anything with them.
+  // Ok, we found a different index.  If they are not ConstantInt, we can't do
+  // anything with them.
   if (!isa<ConstantInt>(C1) || !isa<ConstantInt>(C2))
     return -2; // don't know!
 
@@ -716,7 +716,7 @@
     C1 = ConstantExpr::getSExt(C1, Type::Int64Ty);
 
   if (C2->getType() != Type::Int64Ty)
-    C1 = ConstantExpr::getSExt(C2, Type::Int64Ty);
+    C2 = ConstantExpr::getSExt(C2, Type::Int64Ty);
 
   if (C1 == C2) return 0;  // They are equal
 






More information about the llvm-commits mailing list