[llvm-commits] [llvm] r76675 - in /llvm/trunk: include/llvm/InstrTypes.h lib/VMCore/Instructions.cpp
Dan Gohman
gohman at apple.com
Tue Jul 21 16:19:40 PDT 2009
Author: djg
Date: Tue Jul 21 18:19:40 2009
New Revision: 76675
URL: http://llvm.org/viewvc/llvm-project?rev=76675&view=rev
Log:
Permit the IntPtrTy argument to isEliminableCastPair to be null,
to help support use when TargetData is not available.
Modified:
llvm/trunk/include/llvm/InstrTypes.h
llvm/trunk/lib/VMCore/Instructions.cpp
Modified: llvm/trunk/include/llvm/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InstrTypes.h?rev=76675&r1=76674&r2=76675&view=diff
==============================================================================
--- llvm/trunk/include/llvm/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/InstrTypes.h Tue Jul 21 18:19:40 2009
@@ -479,7 +479,7 @@
const Type *SrcTy, ///< SrcTy of 1st cast
const Type *MidTy, ///< DstTy of 1st cast & SrcTy of 2nd cast
const Type *DstTy, ///< DstTy of 2nd cast
- const Type *IntPtrTy ///< Integer type corresponding to Ptr types
+ const Type *IntPtrTy ///< Integer type corresponding to Ptr types, or null
);
/// @brief Return the opcode of this CastInst
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=76675&r1=76674&r2=76675&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Tue Jul 21 18:19:40 2009
@@ -1890,6 +1890,8 @@
return 0;
case 7: {
// ptrtoint, inttoptr -> bitcast (ptr -> ptr) if int size is >= ptr size
+ if (!IntPtrTy)
+ return 0;
unsigned PtrSize = IntPtrTy->getScalarSizeInBits();
unsigned MidSize = MidTy->getScalarSizeInBits();
if (MidSize >= PtrSize)
@@ -1929,6 +1931,8 @@
return 0;
case 13: {
// inttoptr, ptrtoint -> bitcast if SrcSize<=PtrSize and SrcSize==DstSize
+ if (!IntPtrTy)
+ return 0;
unsigned PtrSize = IntPtrTy->getScalarSizeInBits();
unsigned SrcSize = SrcTy->getScalarSizeInBits();
unsigned DstSize = DstTy->getScalarSizeInBits();
More information about the llvm-commits
mailing list