[llvm] [ValueTracking] Conservative nosync check prevents vectorization (PR #181345)

Kshitij Paranjape via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 14 07:55:39 PST 2026


================
@@ -704,23 +704,57 @@ bool llvm::isValidAssumeForContext(const Instruction *Inv,
 
 bool llvm::willNotFreeBetween(const Instruction *Assume,
                               const Instruction *CtxI) {
-  // Helper to check if there are any calls in the range that may free memory.
-  auto hasNoFreeCalls = [](auto Range) {
+  // Helper to make sure the current function cannot arrange for
+  // another thread to free on its behalf and to check if there
+  // are any calls in the range that may free memory.
+  auto hasNoSyncOrFreeCall = [](auto Range) {
     for (const auto &[Idx, I] : enumerate(Range)) {
       if (Idx > MaxInstrsToCheckForFree)
         return false;
-      if (const auto *CB = dyn_cast<CallBase>(&I))
-        if (!CB->hasFnAttr(Attribute::NoFree))
+      if (I.isVolatile()) {
+        return false;
+      }
+
+      auto isOrderedAtomic = [](const Instruction *Inst) {
----------------
kshitijvp wrote:

Done

https://github.com/llvm/llvm-project/pull/181345


More information about the llvm-commits mailing list