diff options
author | Anders Carlsson <andersca@mac.com> | 2011-02-06 20:22:49 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2011-02-06 20:22:49 +0000 |
commit | ecf8e159e3adbfbb82a6bbe2eebc320c6bac64bd (patch) | |
tree | 8182f046eb386580a8dd52649b18741ef6b333c9 /llvm/lib/Analysis/ConstantFolding.cpp | |
parent | 49d81a3d7e0fa1b3b813af8e74b690249c72f1c8 (diff) | |
download | bcm5719-llvm-ecf8e159e3adbfbb82a6bbe2eebc320c6bac64bd.tar.gz bcm5719-llvm-ecf8e159e3adbfbb82a6bbe2eebc320c6bac64bd.zip |
Simplify test, as suggested by Chris.
llvm-svn: 124990
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 6c99ad32bbe..95e8bde2a83 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/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. |