[PATCH] D31000: AMDGPU: Fix handling of constant phi input loop conditions

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 14:29:30 PDT 2017


arsenm added inline comments.


================
Comment at: lib/Target/AMDGPU/SIAnnotateControlFlow.cpp:298
+  if (isa<Constant>(Cond)) {
+    Instruction *Insert = Cond == BoolTrue ?
+      Term : L->getHeader()->getTerminator();
----------------
cfang wrote:
> Do you think for all constant "Cond" cases, the if.break intrinsics should be inserted to loop header? Not just Cond==BoolTrue? 
> 
> Initially, we insert in the TERM just to resolve an unhandled assert!   
It's the opposite. BoolTrue is not inserted into header. Break true is the normal case. The loop before inserts a break rather than an if.break for this case.

I think the way this works is the assumption is the default incoming value is true. phi.broken is filled with 0s for the other predecessors, which with lowering to and_n2 exec, conditionmask is the same as branch true.


https://reviews.llvm.org/D31000





More information about the llvm-commits mailing list