[PATCH] D70030: [MachineBlockPlacement] Update UnscheduledPredecessors when tail duplicate delete a block.
Huihui Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 14:07:16 PST 2019
huihuiz updated this revision to Diff 229401.
huihuiz edited the summary of this revision.
huihuiz added a comment.
Addressed reviewer feedback -- add more explanation in comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70030/new/
https://reviews.llvm.org/D70030
Files:
llvm/lib/CodeGen/MachineBlockPlacement.cpp
Index: llvm/lib/CodeGen/MachineBlockPlacement.cpp
===================================================================
--- llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -2949,9 +2949,33 @@
SmallVector<MachineBasicBlock *, 8> DuplicatedPreds;
bool IsSimple = TailDup.isSimpleBB(BB);
+ BlockChain &BBChain = *BlockToChain[BB];
TailDup.tailDuplicateAndUpdate(IsSimple, BB, LPred,
&DuplicatedPreds, &RemovalCallbackRef);
+ // Decrease UnscheduledPredecessors previously set for duplicated BB's
+ // BlockChain. Consider duplicate a BB from a chain(as BBChain in the CFG
+ // below) with multiple BBs, and PredBB is coming from different block
+ // chain(as PredChain). The UnscheduledPredecessors counter for BBChain was
+ // increased while calling fillWorkList for BB. When the duplicated BB becomes
+ // a dead block due to tail-duplication, build PredChain may not release the
+ // UnscheduledPredecessors counter for BBChain, as Succ1(also in BBChain) may
+ // not be in the BlockFilter previously collected for PredChain.
+ //
+ // PredBB [PredChain] PredBB [PredChain]
+ // \ / \
+ // BB [BBChain] => Succ0 Succ1 [BBChain]
+ // / \
+ // Succ0 Succ1 [BBChain]
+ if (Removed)
+ for (MachineBasicBlock *Pred : DuplicatedPreds) {
+ if (BlockFilter && !BlockFilter->count(Pred))
+ continue;
+ if (&BBChain != BlockToChain[Pred] &&
+ BBChain.UnscheduledPredecessors != 0)
+ --BBChain.UnscheduledPredecessors;
+ }
+
// Update UnscheduledPredecessors to reflect tail-duplication.
DuplicatedToLPred = false;
for (MachineBasicBlock *Pred : DuplicatedPreds) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70030.229401.patch
Type: text/x-patch
Size: 1770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191114/45bce807/attachment.bin>
More information about the llvm-commits
mailing list