File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
lib/SILOptimizer/SILCombiner Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -477,11 +477,18 @@ SILInstruction *SILCombiner::visitLoadInst(LoadInst *LI) {
477
477
// Given a load with multiple struct_extracts/tuple_extracts and no other
478
478
// uses, canonicalize the load into several (struct_element_addr (load))
479
479
// pairs.
480
- using ProjInstPairTy = std::pair<Projection, SingleValueInstruction *>;
480
+
481
+ struct ProjInstPair {
482
+ Projection P;
483
+ SingleValueInstruction *I;
484
+
485
+ // When sorting, just look at the projection and ignore the instruction.
486
+ bool operator <(const ProjInstPair &RHS) const { return P < RHS.P ; }
487
+ };
481
488
482
489
// Go through the loads uses and add any users that are projections to the
483
490
// projection list.
484
- llvm::SmallVector<ProjInstPairTy , 8 > Projections;
491
+ llvm::SmallVector<ProjInstPair , 8 > Projections;
485
492
for (auto *UI : getNonDebugUses (LI)) {
486
493
auto *User = UI->getUser ();
487
494
@@ -503,8 +510,8 @@ SILInstruction *SILCombiner::visitLoadInst(LoadInst *LI) {
503
510
Projection *LastProj = nullptr ;
504
511
LoadInst *LastNewLoad = nullptr ;
505
512
for (auto &Pair : Projections) {
506
- auto &Proj = Pair.first ;
507
- auto *Inst = Pair.second ;
513
+ auto &Proj = Pair.P ;
514
+ auto *Inst = Pair.I ;
508
515
509
516
// If this projection is the same as the last projection we processed, just
510
517
// replace all uses of the projection with the load we created previously.
You can’t perform that action at this time.
0 commit comments