Fix a crash. Make sure TLI is not null.
authorEvan Cheng <evan.cheng@apple.com>
Fri, 26 Oct 2007 17:24:46 +0000 (17:24 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 26 Oct 2007 17:24:46 +0000 (17:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43384 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index d81ea2b7994ab9dcae80e3b06ffe66435eb29ffa..c5fdc0973459529e1e8e5f3d84b95cc8bbcecb2f 100644 (file)
@@ -972,7 +972,7 @@ bool LoopStrengthReduce::ValidStride(bool HasBaseReg,
     AM.Scale = Scale;
 
     // If load[imm+r*scale] is illegal, bail out.
-    if (!TLI->isLegalAddressingMode(AM, AccessTy))
+    if (TLI && !TLI->isLegalAddressingMode(AM, AccessTy))
       return false;
   }
   return true;