Skip to content

Commit 651edbf

Browse files
committed
Revert "[AliasAnalysis] Document and roll the alias() family of methods. NFC."
@atrick commented that he preferred the non-macro unrolled version. This reverts commit c1dce5c.
1 parent cdacda9 commit 651edbf

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

include/swift/SILAnalysis/AliasAnalysis.h

+22-15
Original file line numberDiff line numberDiff line change
@@ -80,26 +80,33 @@ class AliasAnalysis : public SILAnalysis {
8080

8181
SideEffectAnalysis *getSideEffectAnalysis() const { return SEA; }
8282

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(),
8885
SILType TBAAType2 = SILType());
8986

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;
9591
}
9692

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+
}
10198

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+
}
103110

104111
/// Use the alias analysis to determine the memory behavior of Inst with
105112
/// respect to V.

0 commit comments

Comments
 (0)