diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-02-29 17:52:15 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-02-29 17:52:15 +0000 |
commit | 2e26dc8051e9ba67bffa0c876c1c3b01e28f1055 (patch) | |
tree | 9b9814686bb1f9bab9f7489c60ec2fdbd507e54e /llvm/lib | |
parent | c18bfbb6a68087736cbbeee03fb7b168c7b1b557 (diff) | |
download | bcm5719-llvm-2e26dc8051e9ba67bffa0c876c1c3b01e28f1055.tar.gz bcm5719-llvm-2e26dc8051e9ba67bffa0c876c1c3b01e28f1055.zip |
Fix PR2112: don't run loop aligner if target doesn't have a TargetLowering object.
llvm-svn: 47755
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/LoopAligner.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/LoopAligner.cpp b/llvm/lib/CodeGen/LoopAligner.cpp index a40bb50565d..1888391d5e7 100644 --- a/llvm/lib/CodeGen/LoopAligner.cpp +++ b/llvm/lib/CodeGen/LoopAligner.cpp @@ -24,8 +24,6 @@ using namespace llvm; namespace { class LoopAligner : public MachineFunctionPass { - const TargetLowering *TLI; - public: static char ID; LoopAligner() : MachineFunctionPass((intptr_t)&ID) {} @@ -51,7 +49,11 @@ bool LoopAligner::runOnMachineFunction(MachineFunction &MF) { if (MLI->begin() == MLI->end()) return false; // No loops. - unsigned Align = MF.getTarget().getTargetLowering()->getPrefLoopAlignment(); + const TargetLowering *TLI = MF.getTarget().getTargetLowering(); + if (!TLI) + return false; + + unsigned Align = TLI->getPrefLoopAlignment(); if (!Align) return false; // Don't care about loop alignment. |