[llvm] [IPO] Prevent removal of some convergent attr (PR #134863)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 11 00:50:03 PDT 2025
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <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;
+
+ if (CB->getConvergenceControlToken())
+ return true;
+ }
+ return false;
----------------
arsenm wrote:
This needs to be a conservatively correct true. If the address is captured you do not know the users. If the function is externally visible, you also do not know the users.
https://github.com/llvm/llvm-project/pull/134863
More information about the llvm-commits
mailing list