@@ -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 }
0 commit comments