ssahasra wrote: Sorry to further prolong this, but I finally understood the difference between what I wish was happening and what this patch actually does. The entire discussion so far has been about a hypothetical "readanylane" instruction, but the patch is about S_READFIRSTLANE. The idea of the patch is that if the operand is uniform at def, then readfirstlane it is okay to move it out of convergent control flow. The intention is correct, but I am having trouble agreeing with the implementation:
1. The patch first over-ride the original settings by setting NoConvergent. 2. Then uses "NoConvergent" during selection to mean "the input is uniform, and so this instruction does not depend on Exec". That may work in practice, but it plays loose and fast with semantics. A better way would be: 1. Introduce S_READANYLANE, which is non-convergent by definition. 2. When the argument is uniform at def, replace readfirstlane with readanylane. This can be done early in LLVM IR itself. 3. Don't repurpose NoConvergent just to be able to jump over divergent branches in a peep-hole optimization. https://github.com/llvm/llvm-project/pull/178312 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
