[flang-commits] [flang] WIP: experiment with PR #127845 (PR #128025)

Joel E. Denny via flang-commits flang-commits at lists.llvm.org
Thu Feb 20 08:30:56 PST 2025


https://github.com/jdenny-ornl created https://github.com/llvm/llvm-project/pull/128025

PR #127845 saw [a pre-commit CI error](https://github.com/llvm/llvm-project/pull/127845#issuecomment-2669829610) on windows that I have not deciphered.  I don't have a local windows setup to experiment with it.  I've created this draft PR so I can experiment directly with pre-commit CI without polluting the original PR's history.  Initially, it's a duplicate of that PR.

>From ee79716519e78984b8f106a6dad551464da1149a Mon Sep 17 00:00:00 2001
From: "Joel E. Denny" <jdenny.ornl at gmail.com>
Date: Wed, 19 Feb 2025 13:33:19 -0500
Subject: [PATCH] [flang][NFC] AliasAnalysis: Use Indirect not Unknown for
 LoadOp

As mentioned at
<https://github.com/llvm/llvm-project/pull/126156#discussion_r1953523892>:
PR #126156 causes AliasAnalysis::getSource to sometimes return
SourceKind::Unknown when it used to return SourceKind::Indirect for a
LoadOp.  This patch restores that part of the old behavior.  It should
not affect user-visible behavior because AliasAnalysis::alias treats
SourceKind::Unknown and SourceKind::Indirect equivalently, but it does
improve debugging output.
---
 flang/lib/Optimizer/Analysis/AliasAnalysis.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp b/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
index 70fa18ad65b9b..d881b630d33d9 100644
--- a/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
+++ b/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
@@ -641,14 +641,13 @@ AliasAnalysis::Source AliasAnalysis::getSource(mlir::Value v,
             } else if (isDummyArgument(def)) {
               defOp = nullptr;
               v = def;
+            } else {
+              type = SourceKind::Indirect;
             }
-
-            breakFromLoop = true;
-            return;
+          } else {
+            // No further tracking for addresses loaded from memory for now.
+            type = SourceKind::Indirect;
           }
-
-          // No further tracking for addresses loaded from memory for now.
-          type = SourceKind::Indirect;
           breakFromLoop = true;
         })
         .Case<fir::AddrOfOp>([&](auto op) {



More information about the flang-commits mailing list