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