Skip to content

Commit 942a625

Browse files
committed
Improve some function names and comments
1 parent 0766eba commit 942a625

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

flang/include/flang/Optimizer/Analysis/AliasAnalysis.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,25 @@ struct AliasAnalysis {
157157
bool isData() const;
158158
bool isBoxData() const;
159159

160+
/// @name Dummy Argument Aliasing
161+
///
160162
/// Check conditions related to dummy argument aliasing.
161163
///
162164
/// For all uses, a result of false can prevent MayAlias from being
163165
/// reported, so the list of cases where false is returned is conservative.
164-
/// @{
165-
bool aliasesLikeDummyArg() const;
166-
bool aliasesLikePtrDummyArg() const;
167-
bool canBeActualArg() const;
168-
bool canBeActualArgWithPtr(const mlir::Value *val) const;
169-
/// @}
166+
167+
///@{
168+
/// The address of a (possibly host associated) dummy argument of the
169+
/// current function?
170+
bool mayBeDummyArgOrHostAssoc() const;
171+
/// \c mayBeDummyArgOrHostAssoc and the address of a pointer?
172+
bool mayBePtrDummyArgOrHostAssoc() const;
173+
/// The address of an actual argument of the current function?
174+
bool mayBeActualArg() const;
175+
/// \c mayBeActualArg and the address of either a pointer or a composite
176+
/// with a pointer component?
177+
bool mayBeActualArgWithPtr(const mlir::Value *val) const;
178+
///@}
170179

171180
mlir::Type getType() const;
172181
};

flang/lib/Optimizer/Analysis/AliasAnalysis.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ bool AliasAnalysis::Source::isBoxData() const {
9696
origin.isData;
9797
}
9898

99-
bool AliasAnalysis::Source::aliasesLikeDummyArg() const {
99+
bool AliasAnalysis::Source::mayBeDummyArgOrHostAssoc() const {
100100
return kind != SourceKind::Allocate && kind != SourceKind::Global;
101101
}
102102

103-
bool AliasAnalysis::Source::aliasesLikePtrDummyArg() const {
103+
bool AliasAnalysis::Source::mayBePtrDummyArgOrHostAssoc() const {
104104
// Must alias like dummy arg (or HostAssoc).
105-
if (!aliasesLikeDummyArg())
105+
if (!mayBeDummyArgOrHostAssoc())
106106
return false;
107107
// Must be address of the dummy arg not of a dummy arg component.
108108
if (isRecordWithPointerComponent(valueType))
@@ -111,14 +111,14 @@ bool AliasAnalysis::Source::aliasesLikePtrDummyArg() const {
111111
return attributes.test(Attribute::Pointer) && !isData();
112112
}
113113

114-
bool AliasAnalysis::Source::canBeActualArg() const {
114+
bool AliasAnalysis::Source::mayBeActualArg() const {
115115
return kind != SourceKind::Allocate;
116116
}
117117

118-
bool AliasAnalysis::Source::canBeActualArgWithPtr(
118+
bool AliasAnalysis::Source::mayBeActualArgWithPtr(
119119
const mlir::Value *val) const {
120120
// Must not be local.
121-
if (!canBeActualArg())
121+
if (!mayBeActualArg())
122122
return false;
123123
// Can be address *of* (not *in*) a pointer.
124124
if (attributes.test(Attribute::Pointer) && !isData())
@@ -250,8 +250,8 @@ AliasResult AliasAnalysis::alias(mlir::Value lhs, mlir::Value rhs) {
250250
// composite), so this "if" catches those cases.
251251
if (src1->attributes.test(Attribute::Target) &&
252252
src2->attributes.test(Attribute::Target) &&
253-
((src1->aliasesLikeDummyArg() && src2->canBeActualArg()) ||
254-
(src2->aliasesLikeDummyArg() && src1->canBeActualArg()))) {
253+
((src1->mayBeDummyArgOrHostAssoc() && src2->mayBeActualArg()) ||
254+
(src2->mayBeDummyArgOrHostAssoc() && src1->mayBeActualArg()))) {
255255
LLVM_DEBUG(llvm::dbgs()
256256
<< " aliasing between targets where one is a dummy arg\n");
257257
return AliasResult::MayAlias;
@@ -304,8 +304,10 @@ AliasResult AliasAnalysis::alias(mlir::Value lhs, mlir::Value rhs) {
304304
// print *, p
305305
// end subroutine
306306
// end subroutine
307-
if ((src1->aliasesLikePtrDummyArg() && src2->canBeActualArgWithPtr(val2)) ||
308-
(src2->aliasesLikePtrDummyArg() && src1->canBeActualArgWithPtr(val1))) {
307+
if ((src1->mayBePtrDummyArgOrHostAssoc() &&
308+
src2->mayBeActualArgWithPtr(val2)) ||
309+
(src2->mayBePtrDummyArgOrHostAssoc() &&
310+
src1->mayBeActualArgWithPtr(val1))) {
309311
LLVM_DEBUG(llvm::dbgs()
310312
<< " aliasing between pointer dummy arg and either pointer or "
311313
<< "composite with pointer component\n");

0 commit comments

Comments
 (0)