Skip to content

Commit d4ffa26

Browse files
committed
cleanup
1 parent 4e64702 commit d4ffa26

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

flang/lib/Optimizer/Analysis/AliasAnalysis.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,24 @@
1919
#include "mlir/IR/BuiltinOps.h"
2020
#include "mlir/IR/Value.h"
2121
#include "mlir/Interfaces/SideEffectInterfaces.h"
22+
#include "mlir/Interfaces/ViewLikeInterface.h"
2223
#include "llvm/ADT/TypeSwitch.h"
2324
#include "llvm/Support/Casting.h"
2425
#include "llvm/Support/Debug.h"
25-
#include "mlir/Interfaces/ViewLikeInterface.h"
2626

2727
using namespace mlir;
2828

2929
#define DEBUG_TYPE "fir-alias-analysis"
3030

3131
//===----------------------------------------------------------------------===//
32-
// AliasAnalysis: alias helpers
32+
// AliasAnalysis: allocation detection based on MemAlloc effect
3333
//===----------------------------------------------------------------------===//
3434

35-
static bool tryClassifyAllocateFromEffects(mlir::Operation *op,
36-
mlir::Value candidate, bool allowValueScoped, bool allowOpScoped,
37-
mlir::Value &v, mlir::Operation *&defOp,
38-
fir::AliasAnalysis::SourceKind &type) {
35+
static bool
36+
tryClassifyAllocateFromEffects(mlir::Operation *op, mlir::Value candidate,
37+
bool allowValueScoped, bool allowOpScoped,
38+
mlir::Value &v, mlir::Operation *&defOp,
39+
fir::AliasAnalysis::SourceKind &type) {
3940
auto iface = llvm::dyn_cast<mlir::MemoryEffectOpInterface>(op);
4041
if (!iface)
4142
return false;
@@ -58,8 +59,8 @@ static bool tryClassifyAllocateFromEffects(mlir::Operation *op,
5859
if (!allowOpScoped)
5960
return false;
6061

61-
bool hasOpScopedAlloc = llvm::any_of(
62-
effects, [](const mlir::MemoryEffects::EffectInstance &e) {
62+
bool hasOpScopedAlloc =
63+
llvm::any_of(effects, [](const mlir::MemoryEffects::EffectInstance &e) {
6364
return !e.getValue() &&
6465
mlir::isa<mlir::MemoryEffects::Allocate>(e.getEffect());
6566
});
@@ -618,8 +619,7 @@ AliasAnalysis::Source AliasAnalysis::getSource(mlir::Value v,
618619
// Effect-based detection (op-scoped heuristic only at this level).
619620
if (tryClassifyAllocateFromEffects(defOp, v,
620621
/*allowValueScoped=*/false,
621-
/*allowOpScoped=*/true,
622-
v, defOp, type))
622+
/*allowOpScoped=*/true, v, defOp, type))
623623
break;
624624

625625
llvm::TypeSwitch<Operation *>(defOp)
@@ -711,9 +711,10 @@ AliasAnalysis::Source AliasAnalysis::getSource(mlir::Value v,
711711
if (auto defDefOp = def.getDefiningOp())
712712
classified = tryClassifyAllocateFromEffects(
713713
defDefOp, def,
714-
/*allowValueScoped=*/true, /*allowOpScoped=*/true,
715-
v, defOp, type);
716-
if (!classified) classifyFallbackFrom(def);
714+
/*allowValueScoped=*/true, /*allowOpScoped=*/true, v, defOp,
715+
type);
716+
if (!classified)
717+
classifyFallbackFrom(def);
717718
}
718719
breakFromLoop = true;
719720
return;

0 commit comments

Comments
 (0)