Fix PR2112: don't run loop aligner if target doesn't have a TargetLowering object.

llvm-svn: 47755
This commit is contained in:
Evan Cheng 2008-02-29 17:52:15 +00:00
parent c18bfbb6a6
commit 2e26dc8051
1 changed files with 5 additions and 3 deletions

View File

@ -24,8 +24,6 @@ using namespace llvm;
namespace { namespace {
class LoopAligner : public MachineFunctionPass { class LoopAligner : public MachineFunctionPass {
const TargetLowering *TLI;
public: public:
static char ID; static char ID;
LoopAligner() : MachineFunctionPass((intptr_t)&ID) {} LoopAligner() : MachineFunctionPass((intptr_t)&ID) {}
@ -51,7 +49,11 @@ bool LoopAligner::runOnMachineFunction(MachineFunction &MF) {
if (MLI->begin() == MLI->end()) if (MLI->begin() == MLI->end())
return false; // No loops. 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) if (!Align)
return false; // Don't care about loop alignment. return false; // Don't care about loop alignment.