[flang-commits] [flang] d82a158 - [flang][nfc] Add debug prints to FIR alias analysis

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Aug 8 02:50:12 PDT 2023


Author: Tom Eccles
Date: 2023-08-08T09:44:06Z
New Revision: d82a1581d61e39241c4d87c16626f5ae8fd6597c

URL: https://github.com/llvm/llvm-project/commit/d82a1581d61e39241c4d87c16626f5ae8fd6597c
DIFF: https://github.com/llvm/llvm-project/commit/d82a1581d61e39241c4d87c16626f5ae8fd6597c.diff

LOG: [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

Added: 
    

Modified: 
    flang/lib/Optimizer/Analysis/AliasAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp b/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
index 6af11d7ecc5422..838a8872f38ef8 100644
--- a/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
+++ b/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
@@ -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
 //===----------------------------------------------------------------------===//
@@ -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


        


More information about the flang-commits mailing list