aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-08-19 23:38:22 +0000
committerDan Gohman <gohman@apple.com>2009-08-19 23:38:22 +0000
commit033445fb47c3a33b3a290f552592a823ef466667 (patch)
tree5c96ad99e777df9c77c6fd01837e0302ec3c8aa8
parenta70ed4f7f6e87aa3a9c8d0e21b5bd92eeab3b521 (diff)
downloadexternal_llvm-033445fb47c3a33b3a290f552592a823ef466667.zip
external_llvm-033445fb47c3a33b3a290f552592a823ef466667.tar.gz
external_llvm-033445fb47c3a33b3a290f552592a823ef466667.tar.bz2
Fix a few places to check if TargetData is available before using it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79493 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 7a98b48..5fe8ee8 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -478,9 +478,9 @@ isEliminableCastPair(
// We don't want to form an inttoptr or ptrtoint that converts to an integer
// type that differs from the pointer size.
if ((Res == Instruction::IntToPtr &&
- SrcTy != TD->getIntPtrType(CI->getContext())) ||
+ (!TD || SrcTy != TD->getIntPtrType(CI->getContext()))) ||
(Res == Instruction::PtrToInt &&
- DstTy != TD->getIntPtrType(CI->getContext())))
+ (!TD || DstTy != TD->getIntPtrType(CI->getContext()))))
Res = 0;
return Instruction::CastOps(Res);