Make LSR not crash if invoked without target lowering info, e.g. if invoked
from opt.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96135 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 8dba947..d3c92e7 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1535,10 +1535,10 @@
             const Type *AccessTy = getAccessType(UI->getUser());
             TargetLowering::AddrMode AM;
             AM.Scale = D->getValue()->getSExtValue();
-            if (TLI->isLegalAddressingMode(AM, AccessTy))
+            if (TLI && TLI->isLegalAddressingMode(AM, AccessTy))
               goto decline_post_inc;
             AM.Scale = -AM.Scale;
-            if (TLI->isLegalAddressingMode(AM, AccessTy))
+            if (TLI && TLI->isLegalAddressingMode(AM, AccessTy))
               goto decline_post_inc;
           }
         }