@@ -1826,7 +1826,6 @@ class LoopPromoter : public LoadAndStorePromoter {
1826
1826
ICFLoopSafetyInfo &SafetyInfo;
1827
1827
bool CanInsertStoresInExitBlocks;
1828
1828
ArrayRef<const Instruction *> Uses;
1829
- bool StoreIsGuanteedToExecute;
1830
1829
1831
1830
// We're about to add a use of V in a loop exit block. Insert an LCSSA phi
1832
1831
// (if legal) if doing so would add an out-of-loop use to an instruction
@@ -1853,15 +1852,13 @@ class LoopPromoter : public LoadAndStorePromoter {
1853
1852
SmallVectorImpl<MemoryAccess *> &MSSAIP, PredIteratorCache &PIC,
1854
1853
MemorySSAUpdater &MSSAU, LoopInfo &li, DebugLoc dl,
1855
1854
Align Alignment, bool UnorderedAtomic, const AAMDNodes &AATags,
1856
- ICFLoopSafetyInfo &SafetyInfo, bool CanInsertStoresInExitBlocks,
1857
- bool StoreIsGuanteedToExecute)
1855
+ ICFLoopSafetyInfo &SafetyInfo, bool CanInsertStoresInExitBlocks)
1858
1856
: LoadAndStorePromoter(Insts, S), SomePtr(SP), LoopExitBlocks(LEB),
1859
1857
LoopInsertPts (LIP), MSSAInsertPts(MSSAIP), PredCache(PIC), MSSAU(MSSAU),
1860
1858
LI(li), DL(std::move(dl)), Alignment(Alignment),
1861
1859
UnorderedAtomic(UnorderedAtomic), AATags(AATags),
1862
1860
SafetyInfo(SafetyInfo),
1863
- CanInsertStoresInExitBlocks(CanInsertStoresInExitBlocks), Uses(Insts),
1864
- StoreIsGuanteedToExecute(StoreIsGuanteedToExecute) {}
1861
+ CanInsertStoresInExitBlocks(CanInsertStoresInExitBlocks), Uses(Insts) {}
1865
1862
1866
1863
void insertStoresInLoopExitBlocks () {
1867
1864
// Insert stores after in the loop exit blocks. Each exit block gets a
@@ -1895,7 +1892,7 @@ class LoopPromoter : public LoadAndStorePromoter {
1895
1892
NewSI->setMetadata (LLVMContext::MD_DIAssignID, NewID);
1896
1893
}
1897
1894
1898
- if (AATags && StoreIsGuanteedToExecute )
1895
+ if (AATags)
1899
1896
NewSI->setAAMetadata (AATags);
1900
1897
1901
1898
MemoryAccess *MSSAInsertPoint = MSSAInsertPts[i];
@@ -2093,8 +2090,10 @@ bool llvm::promoteLoopAccessesToScalars(
2093
2090
FoundLoadToPromote = true ;
2094
2091
2095
2092
Align InstAlignment = Load->getAlign ();
2096
- LoadIsGuaranteedToExecute |=
2097
- SafetyInfo->isGuaranteedToExecute (*UI, DT, CurLoop);
2093
+
2094
+ if (!LoadIsGuaranteedToExecute)
2095
+ LoadIsGuaranteedToExecute =
2096
+ SafetyInfo->isGuaranteedToExecute (*UI, DT, CurLoop);
2098
2097
2099
2098
// Note that proving a load safe to speculate requires proving
2100
2099
// sufficient alignment at the target location. Proving it guaranteed
@@ -2240,8 +2239,9 @@ bool llvm::promoteLoopAccessesToScalars(
2240
2239
SSAUpdater SSA (&NewPHIs);
2241
2240
LoopPromoter Promoter (SomePtr, LoopUses, SSA, ExitBlocks, InsertPts,
2242
2241
MSSAInsertPts, PIC, MSSAU, *LI, DL, Alignment,
2243
- SawUnorderedAtomic, AATags, *SafetyInfo,
2244
- StoreSafety == StoreSafe, StoreIsGuanteedToExecute);
2242
+ SawUnorderedAtomic,
2243
+ StoreIsGuanteedToExecute ? AATags : AAMDNodes (),
2244
+ *SafetyInfo, StoreSafety == StoreSafe);
2245
2245
2246
2246
// Set up the preheader to have a definition of the value. It is the live-out
2247
2247
// value from the preheader that uses in the loop will use.
0 commit comments