Make LSR not crash if invoked without target lowering info, e.g. if invoked
authorJohn McCall <rjmccall@apple.com>
Sat, 13 Feb 2010 23:40:16 +0000 (23:40 +0000)
committerJohn McCall <rjmccall@apple.com>
Sat, 13 Feb 2010 23:40:16 +0000 (23:40 +0000)
from opt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96135 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index 8dba947d04a72155517186365f01d15ac3ebd9cb..d3c92e77a09119bf06c674706b10a7d2380a122b 100644 (file)
@@ -1535,10 +1535,10 @@ LSRInstance::OptimizeLoopTermCond() {
             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;
           }
         }