@@ -76,11 +76,6 @@ static inline bool shouldRunBasicAA() {
76
76
77
77
#endif
78
78
79
- static llvm::cl::opt<bool >
80
- CacheAAResults (" cache-aa-results" ,
81
- llvm::cl::desc (" Should AA results be cached" ),
82
- llvm::cl::init(true ));
83
-
84
79
// ===----------------------------------------------------------------------===//
85
80
// Utilities
86
81
// ===----------------------------------------------------------------------===//
@@ -605,9 +600,7 @@ static bool typesMayAlias(SILType T1, SILType T2, SILType TBAA1Ty,
605
600
AliasResult AliasAnalysis::alias (SILValue V1, SILValue V2,
606
601
SILType TBAAType1,
607
602
SILType TBAAType2) {
608
- auto Result = aliasInner (V1, V2, TBAAType1, TBAAType2);
609
- AliasCache.clear ();
610
- return Result;
603
+ return aliasInner (V1, V2, TBAAType1, TBAAType2);
611
604
}
612
605
613
606
// / The main AA entry point. Performs various analyses on V1, V2 in an attempt
@@ -644,24 +637,6 @@ AliasResult AliasAnalysis::aliasInner(SILValue V1, SILValue V2,
644
637
DEBUG (llvm::dbgs () << " After Cast Stripping V1:" << *V1.getDef ());
645
638
DEBUG (llvm::dbgs () << " After Cast Stripping V2:" << *V2.getDef ());
646
639
647
- // Create a key to lookup if we have already computed an alias result for V1,
648
- // V2. Canonicalize our cache keys so that the pointer with the lower address
649
- // is always the first element of the pair. This ensures we do not pollute our
650
- // cache with two entries with the same key, albeit with the key's fields
651
- // swapped.
652
- auto Key = V1 < V2? std::make_pair (V1, V2) : std::make_pair (V2, V1);
653
-
654
- // If we find our key in the cache, just return the alias result.
655
- if (CacheAAResults) {
656
- auto Pair = AliasCache.find (Key);
657
- if (Pair != AliasCache.end ()) {
658
- DEBUG (llvm::dbgs () << " Found value in the cache: " << Pair->second
659
- << " \n " );
660
-
661
- return Pair->second ;
662
- }
663
- }
664
-
665
640
// Ok, we need to actually compute an Alias Analysis result for V1, V2. Begin
666
641
// by finding the "base" of V1, V2 by stripping off all casts and GEPs.
667
642
SILValue O1 = getUnderlyingObject (V1);
@@ -672,7 +647,7 @@ AliasResult AliasAnalysis::aliasInner(SILValue V1, SILValue V2,
672
647
// If O1 and O2 do not equal, see if we can prove that they can not be the
673
648
// same object. If we can, return No Alias.
674
649
if (O1 != O2 && aliasUnequalObjects (O1, O2))
675
- return cacheValue (Key, AliasResult::NoAlias) ;
650
+ return AliasResult::NoAlias;
676
651
677
652
// Ok, either O1, O2 are the same or we could not prove anything based off of
678
653
// their inequality. Now we climb up use-def chains and attempt to do tricks
@@ -690,10 +665,9 @@ AliasResult AliasAnalysis::aliasInner(SILValue V1, SILValue V2,
690
665
if (Projection::isAddrProjection (V1)) {
691
666
AliasResult Result = aliasAddressProjection (V1, V2, O1, O2);
692
667
if (Result != AliasResult::MayAlias)
693
- return cacheValue (Key, Result) ;
668
+ return Result;
694
669
}
695
670
696
-
697
671
// We could not prove anything. Be conservative and return that V1, V2 may
698
672
// alias.
699
673
return AliasResult::MayAlias;
@@ -727,13 +701,6 @@ bool swift::isLetPointer(SILValue V) {
727
701
return false ;
728
702
}
729
703
730
- AliasResult AliasAnalysis::cacheValue (AliasCacheKey Key, AliasResult Result) {
731
- if (!CacheAAResults)
732
- return Result;
733
- DEBUG (llvm::dbgs () << " Caching Alias Result: " << Result << " \n " << Key.first
734
- << Key.second << " \n " );
735
- return AliasCache[Key] = Result;
736
- }
737
704
738
705
void AliasAnalysis::initialize (SILPassManager *PM) {
739
706
SEA = PM->getAnalysis <SideEffectAnalysis>();
0 commit comments