diff options
author | Dan Gohman <gohman@apple.com> | 2009-07-21 23:19:40 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-07-21 23:19:40 +0000 |
commit | 295643b8050d4c45b06032690d707e7281e82c92 (patch) | |
tree | 195e59632537c11b4b354e2fc36b0a6bbdb14d3c | |
parent | aedb59a541b82c62bcaecc6dcdbcd844cd2215b5 (diff) |
Permit the IntPtrTy argument to isEliminableCastPair to be null,
to help support use when TargetData is not available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76675 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/InstrTypes.h | 2 | ||||
-rw-r--r-- | lib/VMCore/Instructions.cpp | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index 1ee2a4b331..c3c48af53f 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -479,7 +479,7 @@ public: 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 diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index e04d54cee3..5e5ce64c1c 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -1890,6 +1890,8 @@ unsigned CastInst::isEliminableCastPair( 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 @@ unsigned CastInst::isEliminableCastPair( 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(); |