mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-20 11:08:27 +00:00
Add an option to disable codegen prepare critical edge splitting. In theory, PHI elimination is already doing all (most?) of the splitting needed. But machine-licm and machine-sink seem to miss some important optimizations when splitting is disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111224 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
44a2c3476b
commit
e1bcb440dc
@ -33,6 +33,7 @@
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/Assembly/Writer.h"
|
||||
#include "llvm/Support/CallSite.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||
#include "llvm/Support/PatternMatch.h"
|
||||
@ -41,6 +42,11 @@
|
||||
using namespace llvm;
|
||||
using namespace llvm::PatternMatch;
|
||||
|
||||
static cl::opt<bool>
|
||||
CriticalEdgeSplit("cgp-critical-edge-splitting",
|
||||
cl::desc("Split critical edges during codegen prepare"),
|
||||
cl::init(true), cl::Hidden);
|
||||
|
||||
namespace {
|
||||
class CodeGenPrepare : public FunctionPass {
|
||||
/// TLI - Keep a pointer of a TargetLowering to consult for determining
|
||||
@ -891,12 +897,14 @@ bool CodeGenPrepare::OptimizeBlock(BasicBlock &BB) {
|
||||
bool MadeChange = false;
|
||||
|
||||
// Split all critical edges where the dest block has a PHI.
|
||||
TerminatorInst *BBTI = BB.getTerminator();
|
||||
if (BBTI->getNumSuccessors() > 1 && !isa<IndirectBrInst>(BBTI)) {
|
||||
for (unsigned i = 0, e = BBTI->getNumSuccessors(); i != e; ++i) {
|
||||
BasicBlock *SuccBB = BBTI->getSuccessor(i);
|
||||
if (isa<PHINode>(SuccBB->begin()) && isCriticalEdge(BBTI, i, true))
|
||||
SplitEdgeNicely(BBTI, i, BackEdges, this);
|
||||
if (CriticalEdgeSplit) {
|
||||
TerminatorInst *BBTI = BB.getTerminator();
|
||||
if (BBTI->getNumSuccessors() > 1 && !isa<IndirectBrInst>(BBTI)) {
|
||||
for (unsigned i = 0, e = BBTI->getNumSuccessors(); i != e; ++i) {
|
||||
BasicBlock *SuccBB = BBTI->getSuccessor(i);
|
||||
if (isa<PHINode>(SuccBB->begin()) && isCriticalEdge(BBTI, i, true))
|
||||
SplitEdgeNicely(BBTI, i, BackEdges, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user