[llvm-commits] [llvm] r79493 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Dan Gohman gohman at apple.com
Wed Aug 19 16:38:22 PDT 2009


Author: djg
Date: Wed Aug 19 18:38:22 2009
New Revision: 79493

URL: http://llvm.org/viewvc/llvm-project?rev=79493&view=rev
Log:
Fix a few places to check if TargetData is available before using it.

Modified:
    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=79493&r1=79492&r2=79493&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Aug 19 18:38:22 2009
@@ -478,9 +478,9 @@
   // 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);





More information about the llvm-commits mailing list