diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp --- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -876,7 +876,7 @@ return OptimizationRemarkMissed(DEBUG_TYPE, "SizeStrideUnequal", MCI) << ore::NV("Inst", "memcpy") << " in " << ore::NV("Function", MCI->getFunction()) - << " function will not be hoised: " + << " function will not be hoisted: " << ore::NV("Reason", "memcpy size is not equal to stride"); }); return false; @@ -998,7 +998,7 @@ mayLoopAccessLocation(Value *Ptr, ModRefInfo Access, Loop *L, const SCEV *BECount, const SCEV *StoreSizeSCEV, AliasAnalysis &AA, - SmallPtrSetImpl &IgnoredStores) { + SmallPtrSetImpl &IgnoredInsts) { // Get the location that may be stored across the loop. Since the access is // strided positively through memory, we say that the modified location starts // at the pointer and has infinite size. @@ -1021,7 +1021,7 @@ for (Loop::block_iterator BI = L->block_begin(), E = L->block_end(); BI != E; ++BI) for (Instruction &I : **BI) - if (IgnoredStores.count(&I) == 0 && + if (IgnoredInsts.count(&I) == 0 && isModOrRefSet( intersectModRef(AA.getModRefInfo(&I, StoreLoc), Access))) return true; @@ -1300,19 +1300,19 @@ // the return value will read this comment, and leave them alone. Changed = true; - SmallPtrSet Stores; - Stores.insert(TheStore); + SmallPtrSet IgnoredInsts; + IgnoredInsts.insert(TheStore); bool IsMemCpy = isa(TheStore); const StringRef InstRemark = IsMemCpy ? "memcpy" : "load and store"; bool UseMemMove = mayLoopAccessLocation(StoreBasePtr, ModRefInfo::ModRef, CurLoop, BECount, - StoreSizeSCEV, *AA, Stores); + StoreSizeSCEV, *AA, IgnoredInsts); if (UseMemMove) { - Stores.insert(TheLoad); + IgnoredInsts.insert(TheLoad); if (mayLoopAccessLocation(StoreBasePtr, ModRefInfo::ModRef, CurLoop, - BECount, StoreSizeSCEV, *AA, Stores)) { + BECount, StoreSizeSCEV, *AA, IgnoredInsts)) { ORE.emit([&]() { return OptimizationRemarkMissed(DEBUG_TYPE, "LoopMayAccessStore", TheStore) @@ -1323,7 +1323,7 @@ }); return Changed; } - Stores.erase(TheLoad); + IgnoredInsts.erase(TheLoad); } const SCEV *LdStart = LoadEv->getStart(); @@ -1342,9 +1342,9 @@ // If the store is a memcpy instruction, we must check if it will write to // the load memory locations. So remove it from the ignored stores. if (IsMemCpy) - Stores.erase(TheStore); + IgnoredInsts.erase(TheStore); if (mayLoopAccessLocation(LoadBasePtr, ModRefInfo::Mod, CurLoop, BECount, - StoreSizeSCEV, *AA, Stores)) { + StoreSizeSCEV, *AA, IgnoredInsts)) { ORE.emit([&]() { return OptimizationRemarkMissed(DEBUG_TYPE, "LoopMayAccessLoad", TheLoad) << ore::NV("Inst", InstRemark) << " in " @@ -1442,8 +1442,8 @@ << " function"; }); - // Okay, the memcpy has been formed. Zap the original store and anything that - // feeds into it. + // Okay, a new call to memcpy/memmove has been formed. Zap the original store + // and anything that feeds into it. if (MSSAU) MSSAU->removeMemoryAccess(TheStore, true); deleteDeadInstruction(TheStore);