summaryrefslogtreecommitdiff
path: root/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-02-06 20:22:49 +0000
committerAnders Carlsson <andersca@mac.com>2011-02-06 20:22:49 +0000
commit5d43ff4e7ea30eaf5a1c417f0ec528900f5c83f2 (patch)
tree50a8a2f0587bc7ccb6de0b2f64ad23e40fc69ec9 /lib/Analysis/ConstantFolding.cpp
parent9c93d48b6b82ffe08e59b130cd38405aa17ca961 (diff)
downloadllvm-5d43ff4e7ea30eaf5a1c417f0ec528900f5c83f2.tar.gz
llvm-5d43ff4e7ea30eaf5a1c417f0ec528900f5c83f2.tar.bz2
llvm-5d43ff4e7ea30eaf5a1c417f0ec528900f5c83f2.tar.xz
Simplify test, as suggested by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124990 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r--lib/Analysis/ConstantFolding.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 6c99ad32bb..95e8bde2a8 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -341,14 +341,10 @@ static bool ReadDataFromGlobal(Constant *C, uint64_t ByteOffset,
}
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
- if (CE->getOpcode() == Instruction::IntToPtr) {
- uint64_t PtrSize = TD.getTypeAllocSize(C->getType());
- uint64_t IntSize = TD.getTypeAllocSize(C->getOperand(0)->getType());
-
- if (PtrSize == IntSize)
+ if (CE->getOpcode() == Instruction::IntToPtr &&
+ CE->getOperand(0)->getType() == TD.getIntPtrType(CE->getContext()))
return ReadDataFromGlobal(CE->getOperand(0), ByteOffset, CurPtr,
BytesLeft, TD);
- }
}
// Otherwise, unknown initializer type.