Permit the IntPtrTy argument to isEliminableCastPair to be null,
to help support use when TargetData is not available.
llvm-svn: 76675
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index e04d54c..5e5ce64 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -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();