From cc2ad058b378673e8cccba34b99857f8f72ff0e6 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 1 May 2009 16:29:14 +0000 Subject: [PATCH] Fix some code to work if TargetLowering is not available. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70546 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 2dc62823ec4..89429b6731d 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -794,10 +794,14 @@ static bool fitsInAddressMode(const SCEVHandle &V, const Type *UseTy, if (const SCEVUnknown *SU = dyn_cast(V)) if (GlobalValue *GV = dyn_cast(SU->getValue())) { - TargetLowering::AddrMode AM; - AM.BaseGV = GV; - AM.HasBaseReg = HasBaseReg; - return TLI->isLegalAddressingMode(AM, UseTy); + if (TLI) { + TargetLowering::AddrMode AM; + AM.BaseGV = GV; + AM.HasBaseReg = HasBaseReg; + return TLI->isLegalAddressingMode(AM, UseTy); + } else { + // Default: assume global addresses are not legal. + } } return false;