Skip to content

Commit 4de521a

Browse files
committed
GC2Stack: Fix logic regression for LLVM 21+
1 parent 30e68f0 commit 4de521a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

gen/passes/GarbageCollect2Stack.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -746,18 +746,16 @@ bool isSafeToStackAllocate(BasicBlock::iterator Alloc, Value *V,
746746
for (auto A = B; A != E; ++A) {
747747
if (A->get() == V) {
748748
#if LDC_LLVM_VER >= 2100
749-
if (CB->paramHasAttr(A - B, llvm::Attribute::AttrKind::Captures)) {
750-
return capturesNothing(
751-
CB->getParamAttr(A - B, llvm::Attribute::AttrKind::Captures)
752-
.getCaptureInfo());
753-
}
754-
749+
if (!(CB->paramHasAttr(A - B, llvm::Attribute::AttrKind::Captures) &&
750+
capturesNothing(
751+
CB->getParamAttr(A - B, llvm::Attribute::AttrKind::Captures)
752+
.getCaptureInfo()))) {
755753
#else
756754
if (!CB->paramHasAttr(A - B, llvm::Attribute::AttrKind::NoCapture)) {
755+
#endif
757756
// The parameter is not marked 'nocapture' - captured.
758757
return false;
759758
}
760-
#endif
761759

762760
if (auto call = dyn_cast<CallInst>(static_cast<Instruction *>(CB))) {
763761
if (call->isTailCall()) {

0 commit comments

Comments
 (0)