[llvm] [Uniformity] Fixed control-div early stop (PR #139667)
Sameer Sahasrabuddhe via llvm-commits
llvm-commits at lists.llvm.org
Thu May 15 23:36:50 PDT 2025
ssahasra wrote:
> Note that the IPD is the exact place where the propagation of labels should stop, because that is the last join point of `DivTermBlock`.
>From the new testcase above, I believe this statement is wrong. E1 is a join that is reachable from A using a path that passes through B (the IPD) and C. So we cannot simply stop at IPD as in #140013 , and we cannot always use it as a floor either.
Falling back to first principles, the overall idea is that we have an ordering provided by ModifiedPO, and starting from the divergent branch, we traverse that order to find every join point. If the IPD is not inside any cycle, then we do not have to look beyond the IPD to find all the joins. If the IPD is inside a cycle (doesn't matter if the branch is in the same cycle or not), then there can be a join that is discovered only after encountering the IPD. In this case, the cycle header is guaranteed to be earlier in ModifiedPO by design, and should be used as the floor. We don't have to follow any fresh label that comes after the header.
So I think the correct solution is to compute the floor as the minimum of of IPD as one argument and the header of the cycle that contains the IPD as the second argument. But which cycle? Is it the smallest cycle containing the IPD, or the largest cycle? Or the common parent of both the divergent branch and the IPD?
https://github.com/llvm/llvm-project/pull/139667
More information about the llvm-commits
mailing list