[PATCH] D70030: [MachineBlockPlacement] Update UnscheduledPredecessors when tail duplicate delete a block.

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 15 08:54:18 PST 2019


Carrot added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineBlockPlacement.cpp:2969
+  //     /   \
+  //  Succ0 Succ1 [BBChain]
+  if (Removed)
----------------
With current layout algorithm it is uncommon to build BBChain before placing PredBB, the most possible situation is BB is a loop header, and PredBB is not in the same loop. Could you write a test case with this hint?



================
Comment at: llvm/lib/CodeGen/MachineBlockPlacement.cpp:2970
+  //  Succ0 Succ1 [BBChain]
+  if (Removed)
+    for (MachineBasicBlock *Pred : DuplicatedPreds) {
----------------
Think about it more and I found it is more complex than the code snippet.

1. Even BB is not completely removed, the UnscheduledPredecessors should also be decremented by the number of actual duplications. The code should be similar to the following loop.

2. In your sample code, there was a UnscheduledPredecessors for the edge PredBB -> BB, even BB is duplicated into PredBB, there is still an edge (PredBB + BB) -> Succ1, so there is another  UnscheduledPredecessors, it doesn't impact the total number of UnscheduledPredecessors for BBChain. Only when BB doesn't fall through/jump to any other block in BBChain, then UnscheduledPredecessors can be decremented for the duplication. Could you double  check if your failure is in this case?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70030/new/

https://reviews.llvm.org/D70030





More information about the llvm-commits mailing list