[flang-commits] [flang] 4492ec7 - Revert "[flang] support (hl)fir.declare in alias analysis"

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Aug 8 03:11:40 PDT 2023


Author: Tom Eccles
Date: 2023-08-08T10:11:23Z
New Revision: 4492ec775c3a4ba080311b8f27f18d12f579ba5e

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

LOG: Revert "[flang] support (hl)fir.declare in alias analysis"

Reverting because of buildbot failure

This reverts commit c732a452ea15d4b7b682b35a72f78c1cdc13f60b.

Added: 
    

Modified: 
    flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
    flang/test/Analysis/AliasAnalysis/alias-analysis-2.fir

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp b/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
index 3d4b9e9b24263d..838a8872f38ef8 100644
--- a/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
+++ b/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
@@ -10,7 +10,6 @@
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIROpsSupport.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
-#include "flang/Optimizer/HLFIR/HLFIROps.h"
 #include "mlir/Analysis/AliasAnalysis.h"
 #include "mlir/IR/BuiltinOps.h"
 #include "mlir/IR/Value.h"
@@ -229,11 +228,6 @@ AliasAnalysis::Source AliasAnalysis::getSource(mlir::Value v) {
           global = llvm::cast<fir::AddrOfOp>(op).getSymbol();
           breakFromLoop = true;
         })
-        .Case<hlfir::DeclareOp, fir::DeclareOp>([&](auto op) {
-          // Track further through the operand
-          v = op.getMemref();
-          defOp = v.getDefiningOp();
-        })
         .Default([&](auto op) {
           defOp = nullptr;
           breakFromLoop = true;

diff  --git a/flang/test/Analysis/AliasAnalysis/alias-analysis-2.fir b/flang/test/Analysis/AliasAnalysis/alias-analysis-2.fir
index ca720cf0ec813a..6c43e8d7cde9ee 100644
--- a/flang/test/Analysis/AliasAnalysis/alias-analysis-2.fir
+++ b/flang/test/Analysis/AliasAnalysis/alias-analysis-2.fir
@@ -171,90 +171,3 @@ func.func @_QFPtest3(%arg0: !fir.ref<!fir.box<!fir.ptr<f32>>> {fir.bindc_name =
   %13 = fir.box_addr %6 {test.ptr = "box.addr"} : (!fir.box<!fir.ptr<f32>>) -> !fir.ptr<f32>
   return
 }
-
-// -----
-
-// CHECK-LABEL: Testing : "_QFPtest4"
-
-// Same as test3 but check that the alias analysis can follow (hl)fir.declare
-// operations
-
-// CHECK-DAG: p#0 <-> func.region0#0: MayAlias
-// CHECK-DAG: p_fir#0 <-> func.region0#0: MayAlias
-// CHECK-DAG: p_hlfir#0 <-> func.region0#0: MayAlias
-// CHECK-DAG: p_hlfir#1 <-> func.region0#0: MayAlias
-
-// CHECK-DAG: p#0 <-> func.region0#1: NoAlias
-// CHECK-DAG: p_fir#0 <-> func.region0#1: NoAlias
-// CHECK-DAG: p_hlfir#0 <-> func.region0#1: NoAlias
-// CHECK-DAG: p_hlfir#1 <-> func.region0#1: NoAlias
-
-// CHECK-DAG: var2#0 <-> p#0: NoAlias
-// CHECK-DAG: var2#0 <-> p_fir#0: NoAlias
-// CHECK-DAG: var2#0 <-> p_hlfir#0: NoAlias
-// CHECK-DAG: var2#0 <-> p_hlfir#1: NoAlias
-// CHECK-DAG: var2_fir#0 <-> p#0: NoAlias
-// CHECK-DAG: var2_fir#0 <-> p_fir#0: NoAlias
-// CHECK-DAG: var2_fir#0 <-> p_hlfir#0: NoAlias
-// CHECK-DAG: var2_fir#0 <-> p_hlfir#1: NoAlias
-// CHECK-DAG: var2_hlfir#0 <-> p#0: NoAlias
-// CHECK-DAG: var2_hlfir#0 <-> p_fir#0: NoAlias
-// CHECK-DAG: var2_hlfir#0 <-> p_hlfir#0: NoAlias
-// CHECK-DAG: var2_hlfir#0 <-> p_hlfir#1: NoAlias
-// CHECK-DAG: var2_hlfir#1 <-> p#0: NoAlias
-// CHECK-DAG: var2_hlfir#1 <-> p_fir#0: NoAlias
-// CHECK-DAG: var2_hlfir#1 <-> p_hlfir#0: NoAlias
-// CHECK-DAG: var2_hlfir#1 <-> p_hlfir#1: NoAlias
-
-// CHECK-DAG: var2#0 <-> func.region0#0: MayAlias
-// CHECK-DAG: var2_fir#0 <-> func.region0#0: MayAlias
-// CHECK-DAG: var2_hlfir#0 <-> func.region0#0: MayAlias
-// CHECK-DAG: var2_hlfir#1 <-> func.region0#0: MayAlias
-
-// CHECK-DAG: var2#0 <-> box.addr#0: MustAlias
-// CHECK-DAG: var2#0 <-> box.addr_fir#0: MustAlias
-// CHECK-DAG: var2#0 <-> box.addr_hlfir#0: MustAlias
-// CHECK-DAG: var2#0 <-> box.addr_hlfir#1: MustAlias
-// CHECK-DAG: var2_fir#0 <-> box.addr#0: MustAlias
-// CHECK-DAG: var2_fir#0 <-> box.addr_fir#0: MustAlias
-// CHECK-DAG: var2_fir#0 <-> box.addr_hlfir#0: MustAlias
-// CHECK-DAG: var2_fir#0 <-> box.addr_hlfir#1: MustAlias
-// CHECK-DAG: var2_hlfir#0 <-> box.addr#0: MustAlias
-// CHECK-DAG: var2_hlfir#0 <-> box.addr_fir#0: MustAlias
-// CHECK-DAG: var2_hlfir#0 <-> box.addr_hlfir#0: MustAlias
-// CHECK-DAG: var2_hlfir#0 <-> box.addr_hlfir#1: MustAlias
-// CHECK-DAG: var2_hlfir#1 <-> box.addr#0: MustAlias
-// CHECK-DAG: var2_hlfir#1 <-> box.addr_fir#0: MustAlias
-// CHECK-DAG: var2_hlfir#1 <-> box.addr_hlfir#0: MustAlias
-// CHECK-DAG: var2_hlfir#1 <-> box.addr_hlfir#1: MustAlias
-
-// CHECK-DAG: var2#0 <-> func.region0#1: NoAlias
-// CHECK-DAG: var2_fir#0 <-> func.region0#1: NoAlias
-// CHECK-DAG: var2_hlfir#0 <-> func.region0#1: NoAlias
-// CHECK-DAG: var2_hlfir#1 <-> func.region0#1: NoAlias
-
-// CHECK-DAG: func.region0#0 <-> func.region0#1: NoAlias
-
-fir.global @_QMpointersEp : !fir.box<!fir.ptr<f32>> {
-  %0 = fir.zero_bits !fir.ptr<f32>
-  %1 = fir.embox %0 : (!fir.ptr<f32>) -> !fir.box<!fir.ptr<f32>>
-  fir.has_value %1 : !fir.box<!fir.ptr<f32>>
-}
-
-fir.global internal @_QFEvar2 target : f32 {
-  %cst = arith.constant 2.000000e+00 : f32
-  fir.has_value %cst : f32
-}
-
-func.func @_QFPtest4(%arg0: !fir.ref<!fir.box<!fir.ptr<f32>>> {fir.bindc_name = "p1"}, %arg1: !fir.ref<f32>) attributes {test.ptr = "func"} {
-  %4 = fir.address_of(@_QFEvar2) {test.ptr = "var2"} : !fir.ref<f32>
-  %fir_decl_var2 = fir.declare %4 {uniq_name = "var2_fir", test.ptr = "var2_fir"}: (!fir.ref<f32>) -> !fir.ref<f32>
-  %hlfir_decl_var2:2 = hlfir.declare %4 {uniq_name = "var2_hlfir", test.ptr = "var2_hlfir"}: (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
-  %5 = fir.address_of(@_QMpointersEp) {test.ptr = "p"} : !fir.ref<!fir.box<!fir.ptr<f32>>>
-  %fir_decl_p = fir.declare %5 {uniq_name = "p_fir", test.ptr = "p_fir"}: (!fir.ref<!fir.box<!fir.ptr<f32>>>) -> !fir.ref<!fir.box<!fir.ptr<f32>>>
-  %hlfir_decl_p:2 = hlfir.declare %5 {uniq_name = "p_hlfir", test.ptr = "p_hlfir"}: (!fir.ref<!fir.box<!fir.ptr<f32>>>) -> (!fir.ref<!fir.box<!fir.ptr<f32>>>, !fir.ref<!fir.box<!fir.ptr<f32>>>)
-  %13 = fir.convert %4 {test.ptr = "box.addr"} : (!fir.ref<f32>) -> !fir.ptr<f32>
-  %fir_decl_convert = fir.declare %13 {uniq_name = "box_addr_fir", test.ptr = "box.addr_fir"}: (!fir.ptr<f32>) -> !fir.ptr<f32>
-  %hlfir_decl_convert:2 = hlfir.declare %13 {uniq_name = "box_addr_hlfir", test.ptr = "box.addr_hlfir"}: (!fir.ptr<f32>) -> (!fir.ptr<f32>, !fir.ptr<f32>)
-  return
-}


        


More information about the flang-commits mailing list