From ecf8e159e3adbfbb82a6bbe2eebc320c6bac64bd Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sun, 6 Feb 2011 20:22:49 +0000 Subject: Simplify test, as suggested by Chris. llvm-svn: 124990 --- llvm/lib/Analysis/ConstantFolding.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Analysis/ConstantFolding.cpp') 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(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. -- cgit v1.2.3