[PATCH] D94748: [AMDGPU] Tidy up conditional branches from early termination
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 15 06:03:17 PST 2021
foad added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/SIInsertSkips.cpp:228
+ // Can we make branch unconditional?
+ bool ReplaceSuccessor = MBB.succ_size() <= 1;
+ if (ReplaceSuccessor)
----------------
I'm confused by this. Why can't you generate an unconditional branch to the early exit block from a BB that happened to have two or more successors?
================
Comment at: llvm/test/CodeGen/AMDGPU/llvm.amdgcn.wqm.demote.ll:11
; SI-NEXT: v_cmp_gt_f32_e32 vcc, 0, v0
-; SI-NEXT: s_andn2_b64 exec, exec, exec
-; SI-NEXT: s_cbranch_scc0 BB0_2
+; SI-NEXT: s_branch BB0_2
; SI-NEXT: ; %bb.1: ; %.entry
----------------
The v_cmp is dead, and so is the whole %bb.1 block. Would you need to run another MachineDCE to get rid of them?
Alternatively could we get rid of dead code at the IR level? Maybe the AMDGPU instCombineIntrinsic could spot that the argument is false and call setDoesNotReturn() on the call?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94748/new/
https://reviews.llvm.org/D94748
More information about the llvm-commits
mailing list