If the loop condition was an i1 phi with a constantexpr input, this
would add a loop intrinsic fed by a phi dependent on a call to
if.break in the same block. Insert the call in the loop header.
Details
Diff Detail
Event Timeline
lib/Target/AMDGPU/SIAnnotateControlFlow.cpp | ||
---|---|---|
298 | 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! |
lib/Target/AMDGPU/SIAnnotateControlFlow.cpp | ||
---|---|---|
298 | 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. |
LGTM It would be great if you can update the comment:
// Insert IfBreak before TERM for constant COND.
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!