Unlike SelectionDAGBuilder, IRTranslator omits the unconditonal branch
in fallthrough cases. Confusingly, the control flow pseudos function
in the opposite way the intrinsics are used, and the branch targets
always need to be swapped. We're inverting the target blocks, so we
need to figure out the old fallthrough block and insert a branch to
the original unconditional branch target.
Details
Diff Detail
Event Timeline
I think the patch is okay, but have a couple of doubts about the tests.
llvm/test/CodeGen/AMDGPU/GlobalISel/divergent-control-flow.ll | ||
---|---|---|
40 | For this and all other similar updates, does this mean that the existing testcases were actually wrong? | |
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-brcond.mir | ||
232 | "backward" is a bit of an understatement when describing this very interesting artifact. I don't know the SI intrinsics very well, but the name suggests it should be a backedge. But this use suggests that the meaning is more general than that: the presence of SI_LOOP instead of a simple conditional branch indicates that the edge is either a backedge or a loop exit. |
llvm/test/CodeGen/AMDGPU/GlobalISel/divergent-control-flow.ll | ||
---|---|---|
40 | Yes | |
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-brcond.mir | ||
232 | Yes, I've been confused by this every time I've ever looked at this. If you look at how SI_LOOP is lowered, it's the s_cbranch_execnz which should be the backedge, but the loop intrinsic on return true exits the loop |
For this and all other similar updates, does this mean that the existing testcases were actually wrong?