@@ -84,33 +84,26 @@ class AliasAnalysis : public SILAnalysis {
84
84
85
85
SideEffectAnalysis *getSideEffectAnalysis () const { return SEA; }
86
86
87
- // / Perform an alias query to see if V1, V2 refer to the same values.
88
- AliasResult alias (SILValue V1, SILValue V2, SILType TBAAType1 = SILType(),
87
+ // / Compute the alias properties of the pointers \p V1 and \p V2.
88
+ // / The optional arguments \pTBAAType1 and \p TBAAType2 specify the exact
89
+ // / types that the pointers access.
90
+ AliasResult alias (SILValue V1, SILValue V2,
91
+ SILType TBAAType1 = SILType(),
89
92
SILType TBAAType2 = SILType());
90
93
91
- // / Convenience method that returns true if V1 and V2 must alias.
92
- bool isMustAlias (SILValue V1, SILValue V2, SILType TBAAType1 = SILType(),
93
- SILType TBAAType2 = SILType()) {
94
- return alias (V1, V2, TBAAType1, TBAAType2) == AliasResult::MustAlias;
94
+ #define ALIAS_PROPERTY_CONVENIENCE_METHOD (KIND ) \
95
+ bool is##KIND(SILValue V1, SILValue V2, \
96
+ SILType TBAAType1 = SILType(), \
97
+ SILType TBAAType2 = SILType()) { \
98
+ return alias (V1, V2, TBAAType1, TBAAType2) == AliasResult::KIND; \
95
99
}
96
100
97
- // / Convenience method that returns true if V1 and V2 partially alias.
98
- bool isPartialAlias (SILValue V1, SILValue V2, SILType TBAAType1 = SILType(),
99
- SILType TBAAType2 = SILType()) {
100
- return alias (V1, V2, TBAAType1, TBAAType2) == AliasResult::PartialAlias;
101
- }
101
+ ALIAS_PROPERTY_CONVENIENCE_METHOD (MustAlias)
102
+ ALIAS_PROPERTY_CONVENIENCE_METHOD (PartialAlias)
103
+ ALIAS_PROPERTY_CONVENIENCE_METHOD (NoAlias)
104
+ ALIAS_PROPERTY_CONVENIENCE_METHOD (MayAlias)
102
105
103
- // / Convenience method that returns true if V1, V2 can not alias.
104
- bool isNoAlias (SILValue V1, SILValue V2, SILType TBAAType1 = SILType(),
105
- SILType TBAAType2 = SILType()) {
106
- return alias (V1, V2, TBAAType1, TBAAType2) == AliasResult::NoAlias;
107
- }
108
-
109
- // / Convenience method that returns true if V1, V2 may alias.
110
- bool isMayAlias (SILValue V1, SILValue V2, SILType TBAAType1 = SILType(),
111
- SILType TBAAType2 = SILType()) {
112
- return alias (V1, V2, TBAAType1, TBAAType2) == AliasResult::MayAlias;
113
- }
106
+ #undef ALIAS_PROPERTY_CONVENIENCE_METHOD
114
107
115
108
// / Use the alias analysis to determine the memory behavior of Inst with
116
109
// / respect to V.
0 commit comments