Skip to content

Commit b84e32b

Browse files
committed
SILOptimizer: avoid accessing the class properties if not necessary in redundant load elimination
The fix here is to just swap two bail-out conditions. It's a NFC regarding the performed optimization, but it avoids importing class properties, which is not needed. This is a speculative fix for rdar://problem/45806457
1 parent a66e769 commit b84e32b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lib/SIL/Projection.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -599,20 +599,7 @@ ProjectionPath::expandTypeIntoLeafProjectionPaths(SILType B, SILModule *Mod,
599599

600600
LLVM_DEBUG(llvm::dbgs() << "Visiting type: " << Ty << "\n");
601601

602-
// Get the first level projection of the current type.
603-
Projections.clear();
604-
Projection::getFirstLevelProjections(Ty, *Mod, Projections);
605-
606-
// Reached the end of the projection tree, this field can not be expanded
607-
// anymore.
608-
if (Projections.empty()) {
609-
LLVM_DEBUG(llvm::dbgs() << " No projections. "
610-
"Finished projection list\n");
611-
Paths.push_back(PP);
612-
continue;
613-
}
614-
615-
// If this is a class type, we also have reached the end of the type
602+
// If this is a class type, we have reached the end of the type
616603
// tree for this type.
617604
//
618605
// We do not push its next level projection into the worklist,
@@ -635,6 +622,19 @@ ProjectionPath::expandTypeIntoLeafProjectionPaths(SILType B, SILModule *Mod,
635622
continue;
636623
}
637624

625+
// Get the first level projection of the current type.
626+
Projections.clear();
627+
Projection::getFirstLevelProjections(Ty, *Mod, Projections);
628+
629+
// Reached the end of the projection tree, this field can not be expanded
630+
// anymore.
631+
if (Projections.empty()) {
632+
LLVM_DEBUG(llvm::dbgs() << " No projections. "
633+
"Finished projection list\n");
634+
Paths.push_back(PP);
635+
continue;
636+
}
637+
638638
// Keep expanding the location.
639639
for (auto &P : Projections) {
640640
ProjectionPath X(B);

0 commit comments

Comments
 (0)