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

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 11:57:47 PDT 2020


arsenm 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)
----------------
rampitec wrote:
> alex-t wrote:
> > rampitec wrote:
> > > 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.
> > Removing block we channge MBBs order.
> > Verifier complains if the new successor is not a branch target and is not "next node" (MBB.getNextNode()).
> > It consider legal fall thru to the next node only.
> > 
> > The branch is only necessary in case of fall thru to make verifier happy
> > 
> This defeats optimization purpose to reduce control flow. This branch will survive till the end, right?
You're just missing a call to updateTerminator? You shouldn't need to leave a branch to a fallthrough just to satisfy the verifier


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

https://reviews.llvm.org/D86634



More information about the llvm-commits mailing list