[flang-commits] [flang] [flang][AliasAnalysis] Relax AliasAnalysis for host associated alloca… (PR #220826)

via flang-commits flang-commits at lists.llvm.org
Wed Sep 2 23:51:16 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- flang/include/flang/Optimizer/Analysis/AliasAnalysis.h flang/lib/Optimizer/Analysis/AliasAnalysis.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp b/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
index ad8dd3f13..4534adb66 100644
--- a/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
+++ b/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
@@ -429,8 +429,7 @@ bool AliasAnalysis::Source::isPointer() const {
 
 bool AliasAnalysis::Source::isDeclaredAllocatable() const {
   auto isAllocatable = [](mlir::Operation *op) {
-    auto var =
-        mlir::dyn_cast_or_null<fir::FortranVariableOpInterface>(op);
+    auto var = mlir::dyn_cast_or_null<fir::FortranVariableOpInterface>(op);
     return var && var.isAllocatable();
   };
 
@@ -848,10 +847,9 @@ AliasResult AliasAnalysis::alias(Source lhsSrc, Source rhsSrc, mlir::Value lhs,
     // at least one is allocatable, since allocatables cannot be EQUIVALENCE
     // objects, provided neither can participate in pointer association.
     if (lhsSrc.kind == SourceKind::HostAssoc) {
-      if (lhsSrc.isData() && rhsSrc.isData() &&
-          !lhsSrc.isTargetOrPointer() && !rhsSrc.isTargetOrPointer() &&
-          (lhsSrc.isDeclaredAllocatable() ||
-           rhsSrc.isDeclaredAllocatable())) {
+      if (lhsSrc.isData() && rhsSrc.isData() && !lhsSrc.isTargetOrPointer() &&
+          !rhsSrc.isTargetOrPointer() &&
+          (lhsSrc.isDeclaredAllocatable() || rhsSrc.isDeclaredAllocatable())) {
         LLVM_DEBUG(llvm::dbgs()
                    << "  no alias: distinct host-associated data involving "
                       "an allocatable\n");

``````````

</details>


https://github.com/llvm/llvm-project/pull/220826


More information about the flang-commits mailing list