Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a45e23b
[ValueTracking] Conservative NoSync check prevents vectorization
kshitijvp May 21, 2026
291b928
Nitpick
kshitijvp May 21, 2026
7ef20bd
Added cleaned Tests
kshitijvp May 21, 2026
8752bd7
Update Test
kshitijvp May 22, 2026
cc94ce5
Nitpick
kshitijvp May 22, 2026
8fd4903
Remove Volatile Check
kshitijvp May 25, 2026
bd85427
Nitpick
kshitijvp May 30, 2026
cb5f6a7
Nitpick
kshitijvp May 30, 2026
615daab
Nitpick
kshitijvp May 30, 2026
a247f2c
Nitpick
kshitijvp May 30, 2026
03fdf50
Modify Test
kshitijvp May 30, 2026
30f80af
Minor Change
kshitijvp May 30, 2026
bcd5a88
Modify Test
kshitijvp May 30, 2026
ce288bd
Nitpick
kshitijvp May 30, 2026
122a413
Nitpick
kshitijvp May 30, 2026
2e56d67
Update Test
kshitijvp May 30, 2026
9a6df94
Merge remote-tracking branch 'origin/main' into issue180180
kshitijvp May 31, 2026
9e04362
nitpick
kshitijvp Feb 13, 2026
bf39dd9
Fixed hasNoSync logic and added negative tests
kshitijvp Feb 13, 2026
b3c08f8
nit
kshitijvp Feb 13, 2026
c56f2ce
Shared isOrderedAtomic function
kshitijvp Feb 14, 2026
4520163
nit
kshitijvp Feb 14, 2026
05197a0
Corrected hasNoSync logic
kshitijvp Feb 14, 2026
d9da6ca
nitpick
kshitijvp Feb 14, 2026
87287cb
Fix FunctionAttrs conflict markers from rebase
kshitijvp May 31, 2026
622601e
Resolve merge conflicts in ValueTracking
kshitijvp May 31, 2026
97183ce
Nitpick
kshitijvp May 31, 2026
fa09e32
Update Test
kshitijvp May 31, 2026
87af6d7
Nitpick
kshitijvp May 31, 2026
425c64e
Modify Tests
kshitijvp Jun 2, 2026
b270ecb
Nitpick
kshitijvp Jun 2, 2026
a135b2a
Merge branch 'main' into issue180180
fhahn Jun 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/include/llvm/Analysis/ValueTracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ inline bool isValidAssumeForContext(const Instruction *I,
}

/// Returns true, if no instruction between \p Assume and \p CtxI may free
/// memory and the function is marked as NoSync. The latter ensures the current
/// or synchronize memory. The latter ensures the current
Comment thread
kshitijvp marked this conversation as resolved.
Outdated
/// function cannot arrange for another thread to free on its behalf.
LLVM_ABI bool willNotFreeBetween(const Instruction *Assume,
const Instruction *CtxI);
Expand Down
20 changes: 16 additions & 4 deletions llvm/lib/Analysis/ValueTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,14 +703,26 @@ 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.
// 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 hasNoFreeCalls = [](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())
Comment thread
nikic marked this conversation as resolved.
Outdated
return false;

if (I.maySynchronize())
return false;

auto *CB = dyn_cast<CallBase>(&I);
if (CB) {
// Non call site cases covered by the two checks above
if (!CB->hasFnAttr(Attribute::NoSync) ||
!CB->hasFnAttr(Attribute::NoFree))
return false;
}
Comment thread
kshitijvp marked this conversation as resolved.
Outdated
}
return true;
};
Expand Down Expand Up @@ -739,7 +751,7 @@ bool llvm::willNotFreeBetween(const Instruction *Assume,
}

// Check if there are any calls between Assume and CtxIter that may free
// memory.
// memory or synchronize.
return hasNoFreeCalls(make_range(Assume->getIterator(), CtxIter));
}

Expand Down