[PATCH] D55313: [LICM] *Actually* disable ControlFlowHoisting.
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 5 02:19:23 PST 2018
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL348345: [LICM] *Actually* disable ControlFlowHoisting. (authored by asbirlea, committed by ).
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55313/new/
https://reviews.llvm.org/D55313
Files:
llvm/trunk/lib/Transforms/Scalar/LICM.cpp
Index: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp
@@ -566,6 +566,8 @@
}
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 @@
// 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;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55313.176778.patch
Type: text/x-patch
Size: 2329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181205/67e21ddb/attachment.bin>
More information about the llvm-commits
mailing list