[llvm-commits] [llvm] r124990 - /llvm/trunk/lib/Analysis/ConstantFolding.cpp
Anders Carlsson
andersca at mac.com
Sun Feb 6 12:22:49 PST 2011
Author: andersca
Date: Sun Feb 6 14:22:49 2011
New Revision: 124990
URL: http://llvm.org/viewvc/llvm-project?rev=124990&view=rev
Log:
Simplify test, as suggested by Chris.
Modified:
llvm/trunk/lib/Analysis/ConstantFolding.cpp
Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=124990&r1=124989&r2=124990&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Sun Feb 6 14:22:49 2011
@@ -341,14 +341,10 @@
}
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.
More information about the llvm-commits
mailing list