[llvm] [IPO] Prevent removal of some convergent attr (PR #134863)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 15 18:39:20 PDT 2025
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/134863 at github.com>
================
@@ -2902,6 +2902,22 @@ struct AANonConvergentImpl : public AANonConvergent {
}
};
+static bool FunctionCalledWithConvergenceToken(const Function *F) {
+ for (auto &Use : F->uses()) {
+ CallBase *CB = dyn_cast<CallBase>(Use.getUser());
+ if (!CB)
+ continue;
+
+ // We are not called, just used as an argument.
+ if (CB->getCalledFunction() != F)
+ continue;
----------------
shiltian wrote:
```suggestion
if (!CB || CB->getCalledFunction() != F)
continue;
```
https://github.com/llvm/llvm-project/pull/134863
More information about the llvm-commits
mailing list