Skip to content

Commit d82a158

Browse files
committed
[flang][nfc] Add debug prints to FIR alias analysis
These make it easier to debug and improve alias analysis. Enable with --debug-only=fir-alias-analysis. Differential Revision: https://reviews.llvm.org/D157105
1 parent 7f32088 commit d82a158

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

flang/lib/Optimizer/Analysis/AliasAnalysis.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
#include "mlir/Interfaces/SideEffectInterfaces.h"
1717
#include "llvm/ADT/TypeSwitch.h"
1818
#include "llvm/Support/Casting.h"
19+
#include "llvm/Support/Debug.h"
1920

2021
using namespace mlir;
2122

23+
#define DEBUG_TYPE "fir-alias-analysis"
24+
2225
//===----------------------------------------------------------------------===//
2326
// AliasAnalysis: alias
2427
//===----------------------------------------------------------------------===//
@@ -67,6 +70,12 @@ bool AliasAnalysis::Source::isRecordWithPointerComponent() const {
6770
AliasResult AliasAnalysis::alias(Value lhs, Value rhs) {
6871
auto lhsSrc = getSource(lhs);
6972
auto rhsSrc = getSource(rhs);
73+
LLVM_DEBUG(llvm::dbgs() << "AliasAnalysis::alias\n";
74+
llvm::dbgs() << " lhs: " << lhs << "\n";
75+
llvm::dbgs() << " lhsSrc: " << lhsSrc << "\n";
76+
llvm::dbgs() << " rhs: " << rhs << "\n";
77+
llvm::dbgs() << " rhsSrc: " << rhsSrc << "\n";
78+
llvm::dbgs() << "\n";);
7079

7180
// Indirect case currently not handled. Conservatively assume
7281
// it aliases with everything

0 commit comments

Comments
 (0)