Skip to content

Commit

Permalink
[flang][nfc] Add debug prints to FIR alias analysis
Browse files Browse the repository at this point in the history
These make it easier to debug and improve alias analysis. Enable with
--debug-only=fir-alias-analysis.

Differential Revision: https://reviews.llvm.org/D157105
  • Loading branch information
tblah committed Aug 8, 2023
1 parent 7f32088 commit d82a158
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"

using namespace mlir;

#define DEBUG_TYPE "fir-alias-analysis"

//===----------------------------------------------------------------------===//
// AliasAnalysis: alias
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -67,6 +70,12 @@ bool AliasAnalysis::Source::isRecordWithPointerComponent() const {
AliasResult AliasAnalysis::alias(Value lhs, Value rhs) {
auto lhsSrc = getSource(lhs);
auto rhsSrc = getSource(rhs);
LLVM_DEBUG(llvm::dbgs() << "AliasAnalysis::alias\n";
llvm::dbgs() << " lhs: " << lhs << "\n";
llvm::dbgs() << " lhsSrc: " << lhsSrc << "\n";
llvm::dbgs() << " rhs: " << rhs << "\n";
llvm::dbgs() << " rhsSrc: " << rhsSrc << "\n";
llvm::dbgs() << "\n";);

// Indirect case currently not handled. Conservatively assume
// it aliases with everything
Expand Down

0 comments on commit d82a158

Please sign in to comment.