Fix a few places to check if TargetData is available before using it.
llvm-svn: 79493
This commit is contained in:
parent
cb13b48969
commit
7167f42769
|
@ -478,9 +478,9 @@ isEliminableCastPair(
|
||||||
// We don't want to form an inttoptr or ptrtoint that converts to an integer
|
// We don't want to form an inttoptr or ptrtoint that converts to an integer
|
||||||
// type that differs from the pointer size.
|
// type that differs from the pointer size.
|
||||||
if ((Res == Instruction::IntToPtr &&
|
if ((Res == Instruction::IntToPtr &&
|
||||||
SrcTy != TD->getIntPtrType(CI->getContext())) ||
|
(!TD || SrcTy != TD->getIntPtrType(CI->getContext()))) ||
|
||||||
(Res == Instruction::PtrToInt &&
|
(Res == Instruction::PtrToInt &&
|
||||||
DstTy != TD->getIntPtrType(CI->getContext())))
|
(!TD || DstTy != TD->getIntPtrType(CI->getContext()))))
|
||||||
Res = 0;
|
Res = 0;
|
||||||
|
|
||||||
return Instruction::CastOps(Res);
|
return Instruction::CastOps(Res);
|
||||||
|
|
Loading…
Reference in New Issue