summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/ConstantFolding.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-04-05 01:30:19 +0000
committerChris Lattner <sabre@nondot.org>2004-04-05 01:30:19 +0000
commit69193f93b689d3cc03ec9e685d662003d06134ea (patch)
treeed36e2aa107383c32cc79bfb71deb1547afed277 /llvm/lib/VMCore/ConstantFolding.cpp
parentfd9fbe187d9d4143f07f575f0722f185ab0ce945 (diff)
downloadbcm5719-llvm-69193f93b689d3cc03ec9e685d662003d06134ea.tar.gz
bcm5719-llvm-69193f93b689d3cc03ec9e685d662003d06134ea.zip
Support getelementptr instructions which use uint's to index into structure
types and can have arbitrary 32- and 64-bit integer types indexing into sequential types. llvm-svn: 12653
Diffstat (limited to 'llvm/lib/VMCore/ConstantFolding.cpp')
-rw-r--r--llvm/lib/VMCore/ConstantFolding.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/VMCore/ConstantFolding.cpp b/llvm/lib/VMCore/ConstantFolding.cpp
index db21bd3d782..1fee5012b45 100644
--- a/llvm/lib/VMCore/ConstantFolding.cpp
+++ b/llvm/lib/VMCore/ConstantFolding.cpp
@@ -608,10 +608,10 @@ static int IdxCompare(Constant *C1, Constant *C2) {
if (!isa<ConstantInt>(C1) || !isa<ConstantInt>(C2))
return -2; // don't know!
- // Ok, we have two differing integer indices. Convert them to
- // be the same type. Long is always big enough, so we use it.
- C1 = ConstantExpr::getCast(C1, Type::LongTy);
- C2 = ConstantExpr::getCast(C2, Type::LongTy);
+ // Ok, we have two differing integer indices. Sign extend them to be the same
+ // type. Long is always big enough, so we use it.
+ C1 = ConstantExpr::getSignExtend(C1, Type::LongTy);
+ C2 = ConstantExpr::getSignExtend(C2, Type::LongTy);
if (C1 == C2) return 0; // Are they just differing types?
// If they are really different, now that they are the same type, then we
OpenPOWER on IntegriCloud