[PATCH] D69498: IR: Invert convergent attribute handling

Sameer Sahasrabuddhe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 20 15:59:09 PDT 2021


sameerds added a comment.

The way I see it, the notion of convergence is relevant only to a certain class of targets (usually represented by GPUs) and it only affects certain optimizations. Then why not have only these optimizations check `TTI` to see if convergence matters? `TTI.hasBranchDivergence()` seems like a sufficient proxy for this information.

1. `convergent` becomes the default in LLVM IR, but it does not affect optimizations on non-GPU targets.
2. This is not a reinterpretation of the same IR on different targets. The notional execution model of LLVM IR will say that all function calls are convergent. Targets that only care about one thread at a time represent the degenerate case where all executions are convergent anyway.

This recasts the whole question to be one about combining optimizations with target-specific information. The only changes required are in transforms that check `CallInst::isConvergent()`. These should now also check `TTI`, possibly adding a dependency on the `TTI` analysis where it didn't exist earlier.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69498/new/

https://reviews.llvm.org/D69498



More information about the cfe-commits mailing list