[PATCH] D89397: [AMDGPU] SILowerControlFlow::removeMBBifRedundant should not try to change MBB layout if it can fallthrough

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 15 05:11:07 PDT 2020


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp:689-690
+    MachineBasicBlock *Ret = nullptr;
+    for (auto *S : MBB->successors()) {
+      if (MBB->isLayoutSuccessor(S)) {
+        // The only fallthrough candidate
----------------
You don't need to iterate to find the layout successor, just use std::next or similar.


================
Comment at: llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp:707
+
   bool Redundant = true;
   for (auto &I : MBB.instrs()) {
----------------
Remove this and just return early if it's not redundant?


================
Comment at: llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp:714-716
     SmallVector<MachineBasicBlock *, 2> Preds(MBB.predecessors());
+    MachineBasicBlock *FallThrough = nullptr;
     for (auto P : Preds) {
----------------
Why do we need the SmallVector? Why not just iterate over MBB.predecessors()?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89397



More information about the llvm-commits mailing list