summaryrefslogtreecommitdiff
path: root/lib/VMCore/ConstantFold.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-31 21:43:30 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-31 21:43:30 +0000
commitcc615c38b189f36b4a4a2b515232f69e63717d26 (patch)
treef0bebc51378e36990771c0537d668c1bb918072d /lib/VMCore/ConstantFold.cpp
parentc28d2bc476cd3a75612596718cef9bed997e8fc0 (diff)
downloadllvm-cc615c38b189f36b4a4a2b515232f69e63717d26.tar.gz
llvm-cc615c38b189f36b4a4a2b515232f69e63717d26.tar.bz2
llvm-cc615c38b189f36b4a4a2b515232f69e63717d26.tar.xz
Fix a bug in comparison of GEP indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32798 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r--lib/VMCore/ConstantFold.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index 9d7bbc518e..20de93cce5 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.cpp
@@ -299,7 +299,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
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 bool isMaybeZeroSizedType(const Type *Ty) {
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 @@ static int IdxCompare(Constant *C1, Constant *C2, const Type *ElTy) {
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