summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAlina Sbirlea <asbirlea@google.com>2018-12-05 10:16:21 +0000
committerAlina Sbirlea <asbirlea@google.com>2018-12-05 10:16:21 +0000
commit0e216854f93fd6d50974bc83a74b189789c588d6 (patch)
tree3d984c6767551287c4fb6a9c3beb45b682630e1e /llvm/lib
parent71a29aa94791675265379e3ba1b06c13c9240647 (diff)
downloadbcm5719-llvm-0e216854f93fd6d50974bc83a74b189789c588d6.tar.gz
bcm5719-llvm-0e216854f93fd6d50974bc83a74b189789c588d6.zip
[LICM] *Actually* disable ControlFlowHoisting.
Summary: The remaining code paths that ControlFlowHoisting introduced that were not disabled, increased compile time by 3x for some benchmarks. The time is spent in DominatorTree updates. Reviewers: john.brawn, mkazantsev Subscribers: sanjoy, jlebar, llvm-commits Differential Revision: https://reviews.llvm.org/D55313 llvm-svn: 348345
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index ff94e86c7da..695eaf6cf4a 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -566,6 +566,8 @@ public:
}
BasicBlock *getOrCreateHoistedBlock(BasicBlock *BB) {
+ if (!ControlFlowHoisting)
+ return CurLoop->getLoopPreheader();
// If BB has already been hoisted, return that
if (HoistDestinationMap.count(BB))
return HoistDestinationMap[BB];
@@ -801,21 +803,24 @@ bool llvm::hoistRegion(DomTreeNode *N, AliasAnalysis *AA, LoopInfo *LI,
// and also keep track of where in the block we are rehoisting to to make sure
// that we rehoist instructions before the instructions that use them.
Instruction *HoistPoint = nullptr;
- for (Instruction *I : reverse(HoistedInstructions)) {
- if (!llvm::all_of(I->uses(), [&](Use &U) { return DT->dominates(I, U); })) {
- BasicBlock *Dominator =
- DT->getNode(I->getParent())->getIDom()->getBlock();
- LLVM_DEBUG(dbgs() << "LICM rehoisting to " << Dominator->getName() << ": "
- << *I << "\n");
- if (!HoistPoint || HoistPoint->getParent() != Dominator) {
- if (HoistPoint)
- assert(DT->dominates(Dominator, HoistPoint->getParent()) &&
- "New hoist point expected to dominate old hoist point");
- HoistPoint = Dominator->getTerminator();
+ if (ControlFlowHoisting) {
+ for (Instruction *I : reverse(HoistedInstructions)) {
+ if (!llvm::all_of(I->uses(),
+ [&](Use &U) { return DT->dominates(I, U); })) {
+ BasicBlock *Dominator =
+ DT->getNode(I->getParent())->getIDom()->getBlock();
+ LLVM_DEBUG(dbgs() << "LICM rehoisting to " << Dominator->getName()
+ << ": " << *I << "\n");
+ if (!HoistPoint || HoistPoint->getParent() != Dominator) {
+ if (HoistPoint)
+ assert(DT->dominates(Dominator, HoistPoint->getParent()) &&
+ "New hoist point expected to dominate old hoist point");
+ HoistPoint = Dominator->getTerminator();
+ }
+ moveInstructionBefore(*I, *HoistPoint, *SafetyInfo);
+ HoistPoint = I;
+ Changed = true;
}
- moveInstructionBefore(*I, *HoistPoint, *SafetyInfo);
- HoistPoint = I;
- Changed = true;
}
}
OpenPOWER on IntegriCloud