mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[load-store-opts] Avoid re-loading values of "let"-variables
Teach LoadStoreOpts to handle "let" variables properly. Such variables should be loaded only once and their loaded values can be reused. This is safe, because once assigned these variables cannot change their value. Swift SVN r27915
This commit is contained in:
@@ -855,7 +855,7 @@ void LSBBForwarder::invalidateReadFromStores(LSContext &Ctx,
|
||||
AliasAnalysis *AA = Ctx.getAA();
|
||||
llvm::SmallVector<SILValue, 4> InvalidatedStoreList;
|
||||
for (auto &P : Stores)
|
||||
if (P.second.aliasingRead(AA, Inst))
|
||||
if (P.second.aliasingRead(AA, Inst) && !isLetPointer(P.first))
|
||||
InvalidatedStoreList.push_back(P.first);
|
||||
|
||||
for (SILValue SIOp : InvalidatedStoreList) {
|
||||
|
||||
Reference in New Issue
Block a user