summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/PHIElimination.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2009-11-17 19:15:50 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2009-11-17 19:15:50 +0000
commitfffff88a3c431dcec73dbeb26b890b601d4cc24a (patch)
tree3fa1597f18387ecf6363e2bf3ade42f3ba52134f /llvm/lib/CodeGen/PHIElimination.cpp
parentd3612399c51c90a0758332454f2440cc101cb138 (diff)
downloadbcm5719-llvm-fffff88a3c431dcec73dbeb26b890b601d4cc24a.tar.gz
bcm5719-llvm-fffff88a3c431dcec73dbeb26b890b601d4cc24a.zip
Enable -split-phi-edges by default, except when -regalloc=local.
The local register allocator doesn't like it when LiveVariables is run. We should also disable edge splitting under -O0, but that has to wait a bit. llvm-svn: 89125
Diffstat (limited to 'llvm/lib/CodeGen/PHIElimination.cpp')
-rw-r--r--llvm/lib/CodeGen/PHIElimination.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp
index c4f2cc7a75d..fc6574290b3 100644
--- a/llvm/lib/CodeGen/PHIElimination.cpp
+++ b/llvm/lib/CodeGen/PHIElimination.cpp
@@ -21,6 +21,7 @@
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/CodeGen/RegAllocRegistry.h"
#include "llvm/Function.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/ADT/SmallPtrSet.h"
@@ -39,7 +40,7 @@ STATISTIC(NumSplits, "Number of critical edges split on demand");
static cl::opt<bool>
SplitEdges("split-phi-edges",
cl::desc("Split critical edges during phi elimination"),
- cl::init(false), cl::Hidden);
+ cl::init(true), cl::Hidden);
char PHIElimination::ID = 0;
static RegisterPass<PHIElimination>
@@ -47,10 +48,21 @@ X("phi-node-elimination", "Eliminate PHI nodes for register allocation");
const PassInfo *const llvm::PHIEliminationID = &X;
+namespace llvm { FunctionPass *createLocalRegisterAllocator(); }
+
+// Should we run edge splitting?
+static bool shouldSplitEdges() {
+ // Edge splitting breaks the local register allocator. It cannot tolerate
+ // LiveVariables being run.
+ if (RegisterRegAlloc::getDefault() == createLocalRegisterAllocator)
+ return false;
+ return SplitEdges;
+}
+
void llvm::PHIElimination::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addPreserved<LiveVariables>();
AU.addPreserved<MachineDominatorTree>();
- if (SplitEdges) {
+ if (shouldSplitEdges()) {
AU.addRequired<LiveVariables>();
} else {
AU.setPreservesCFG();
@@ -67,7 +79,7 @@ bool llvm::PHIElimination::runOnMachineFunction(MachineFunction &Fn) {
bool Changed = false;
// Split critical edges to help the coalescer
- if (SplitEdges)
+ if (shouldSplitEdges())
for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
Changed |= SplitPHIEdges(Fn, *I);
OpenPOWER on IntegriCloud