[llvm] [LoopFusion] Do not fuse loops containing convergent operations (PR #203460)
Madhur Amilkanthwar via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 23 22:10:25 PDT 2026
================
@@ -203,6 +204,16 @@ struct FusionCandidate {
"Loop contains an atomic access");
return;
}
+ // A convergent operation requires the set of threads executing it to be
+ // unchanged; fusion moves it into a different loop, so reject the
+ // candidate. See LangRef on the 'convergent' attribute.
+ if (const auto *CB = dyn_cast<CallBase>(&I); CB && CB->isConvergent()) {
+ invalidate();
+ ++ContainsConvergentOp;
+ reportInvalidCandidate("ContainsConvergentOp",
+ "Loop contains a convergent operation");
+ return;
+ }
----------------
madhur13490 wrote:
Sorry, I don't understand -- what are we concluding here?
https://github.com/llvm/llvm-project/pull/203460
More information about the llvm-commits
mailing list