aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/LoopAligner.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-02-29 17:52:15 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-02-29 17:52:15 +0000
commit329344e006d93fe339b87dd927a987dbce84f34f (patch)
treeb4110717b2b521c7a833b8558e095bf0b605e32f /lib/CodeGen/LoopAligner.cpp
parent5f062546748e9356b6b3dd8e653d6a6758d5253a (diff)
downloadexternal_llvm-329344e006d93fe339b87dd927a987dbce84f34f.tar.gz
external_llvm-329344e006d93fe339b87dd927a987dbce84f34f.tar.bz2
external_llvm-329344e006d93fe339b87dd927a987dbce84f34f.zip
Fix PR2112: don't run loop aligner if target doesn't have a TargetLowering object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LoopAligner.cpp')
-rw-r--r--lib/CodeGen/LoopAligner.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/CodeGen/LoopAligner.cpp b/lib/CodeGen/LoopAligner.cpp
index a40bb50565..1888391d5e 100644
--- a/lib/CodeGen/LoopAligner.cpp
+++ b/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.