[llvm] [ValueTracking] Conservative nosync check prevents vectorization (PR #181345)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 13 03:25:26 PST 2026
================
@@ -716,10 +716,18 @@ bool llvm::willNotFreeBetween(const Instruction *Assume,
return true;
};
- // Make sure the current function cannot arrange for another thread to free on
- // its behalf.
- if (!CtxI->getFunction()->hasNoSync())
- return false;
+ // Helper to make sure the current function cannot arrange for
+ // another thread to free on its behalf.
+ auto hasNoSyncCalls = [](auto Range) {
+ for (const auto &[Idx, I] : enumerate(Range)) {
+ if (Idx > MaxInstrsToCheckForFree)
+ return false;
+ if (const auto *CB = dyn_cast<CallBase>(&I))
----------------
nikic wrote:
You can't just ignore non-call instructions here, they can be synchronizing (like atomic load/store).
https://github.com/llvm/llvm-project/pull/181345
More information about the llvm-commits
mailing list