Skip to content

Commit 4c668f8

Browse files
committed
[lifetime] Disable all lifetime
1 parent cfa57ba commit 4c668f8

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

llvm/lib/CodeGen/AtomicExpandPass.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,9 @@ bool AtomicExpand::expandAtomicOpToLibcall(
18601860
if (CASExpected) {
18611861
AllocaCASExpected = AllocaBuilder.CreateAlloca(CASExpected->getType());
18621862
AllocaCASExpected->setAlignment(AllocaAlignment);
1863+
#ifndef _WIN32
18631864
Builder.CreateLifetimeStart(AllocaCASExpected, SizeVal64);
1865+
#endif
18641866
Builder.CreateAlignedStore(CASExpected, AllocaCASExpected, AllocaAlignment);
18651867
Args.push_back(AllocaCASExpected);
18661868
}
@@ -1874,7 +1876,9 @@ bool AtomicExpand::expandAtomicOpToLibcall(
18741876
} else {
18751877
AllocaValue = AllocaBuilder.CreateAlloca(ValueOperand->getType());
18761878
AllocaValue->setAlignment(AllocaAlignment);
1879+
#ifndef _WIN32
18771880
Builder.CreateLifetimeStart(AllocaValue, SizeVal64);
1881+
#endif
18781882
Builder.CreateAlignedStore(ValueOperand, AllocaValue, AllocaAlignment);
18791883
Args.push_back(AllocaValue);
18801884
}
@@ -1884,7 +1888,9 @@ bool AtomicExpand::expandAtomicOpToLibcall(
18841888
if (!CASExpected && HasResult && !UseSizedLibcall) {
18851889
AllocaResult = AllocaBuilder.CreateAlloca(I->getType());
18861890
AllocaResult->setAlignment(AllocaAlignment);
1891+
#ifndef _WIN32
18871892
Builder.CreateLifetimeStart(AllocaResult, SizeVal64);
1893+
#endif
18881894
Args.push_back(AllocaResult);
18891895
}
18901896

@@ -1914,19 +1920,21 @@ bool AtomicExpand::expandAtomicOpToLibcall(
19141920
CallInst *Call = Builder.CreateCall(LibcallFn, Args);
19151921
Call->setAttributes(Attr);
19161922
Value *Result = Call;
1917-
1923+
#ifndef _WIN32
19181924
// And then, extract the results...
19191925
if (ValueOperand && !UseSizedLibcall)
19201926
Builder.CreateLifetimeEnd(AllocaValue, SizeVal64);
1921-
1927+
#endif
19221928
if (CASExpected) {
19231929
// The final result from the CAS is {load of 'expected' alloca, bool result
19241930
// from call}
19251931
Type *FinalResultTy = I->getType();
19261932
Value *V = PoisonValue::get(FinalResultTy);
19271933
Value *ExpectedOut = Builder.CreateAlignedLoad(
19281934
CASExpected->getType(), AllocaCASExpected, AllocaAlignment);
1935+
#ifndef _WIN32
19291936
Builder.CreateLifetimeEnd(AllocaCASExpected, SizeVal64);
1937+
#endif
19301938
V = Builder.CreateInsertValue(V, ExpectedOut, 0);
19311939
V = Builder.CreateInsertValue(V, Result, 1);
19321940
I->replaceAllUsesWith(V);
@@ -1937,7 +1945,9 @@ bool AtomicExpand::expandAtomicOpToLibcall(
19371945
else {
19381946
V = Builder.CreateAlignedLoad(I->getType(), AllocaResult,
19391947
AllocaAlignment);
1948+
#ifndef _WIN32
19401949
Builder.CreateLifetimeEnd(AllocaResult, SizeVal64);
1950+
#endif
19411951
}
19421952
I->replaceAllUsesWith(V);
19431953
}

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3370,6 +3370,7 @@ class llvm::sroa::AllocaSliceRewriter
33703370
// for the new alloca slice.
33713371
Type *PointerTy = IRB.getInt8PtrTy(OldPtr->getType()->getPointerAddressSpace());
33723372
Value *Ptr = getNewAllocaSlicePtr(IRB, PointerTy);
3373+
#ifndef _WIN32
33733374
Value *New;
33743375
if (II.getIntrinsicID() == Intrinsic::lifetime_start)
33753376
New = IRB.CreateLifetimeStart(Ptr, Size);
@@ -3378,7 +3379,7 @@ class llvm::sroa::AllocaSliceRewriter
33783379

33793380
(void)New;
33803381
LLVM_DEBUG(dbgs() << " to: " << *New << "\n");
3381-
3382+
#endif
33823383
return true;
33833384
}
33843385

llvm/lib/Transforms/Utils/InlineFunction.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2435,8 +2435,9 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI,
24352435
AllocaArraySize * AllocaTypeSize);
24362436
}
24372437
}
2438-
2438+
#ifndef _WIN32
24392439
builder.CreateLifetimeStart(AI, AllocaSize);
2440+
#endif
24402441
for (ReturnInst *RI : Returns) {
24412442
// Don't insert llvm.lifetime.end calls between a musttail or deoptimize
24422443
// call and a return. The return kills all local allocas.
@@ -2446,7 +2447,9 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI,
24462447
if (InlinedDeoptimizeCalls &&
24472448
RI->getParent()->getTerminatingDeoptimizeCall())
24482449
continue;
2450+
#ifndef _WIN32
24492451
IRBuilder<>(RI).CreateLifetimeEnd(AI, AllocaSize);
2452+
#endif
24502453
}
24512454
}
24522455
}

0 commit comments

Comments
 (0)