[PATCH] D86634: [AMDGPU] SILowerControlFlow::optimizeEndCF should remove empty basic block

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 12:57:44 PDT 2020


rampitec added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp:697
+        MachineInstr *Br =
+            BuildMI(P, DebugLoc(), TII->get(AMDGPU::S_BRANCH)).addMBB(Succ);
+        if (LIS)
----------------
You do not need this branch if target is a fall thru block.
You also do not seem a testcase when it is not and this branch is needed.


================
Comment at: llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp:158
     AU.addPreservedID(MachineLoopInfoID);
     AU.addPreservedID(MachineDominatorsID);
-    AU.setPreservesCFG();
----------------
alex-t wrote:
> rampitec wrote:
> > Does it preserve MDT and MLI now?
> yes. your initial assumption was a chain of single successors. So, if we remove block, we remove it from that chain.
I assume when you remove a block you also need to call at least MLI::removeBlock() and MDT::eraseNode() to call them preserved.


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

https://reviews.llvm.org/D86634



More information about the llvm-commits mailing list