[flang-commits] [flang] [flang] Stop running array-value-copy in the default pipeline (PR #211816)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Fri Jul 24 07:48:13 PDT 2026


https://github.com/eugeneepshteyn created https://github.com/llvm/llvm-project/pull/211816

Since the removal of the legacy expression lowering (#210385, #210621, #210639, #210873), nothing in flang produces the array-value operations (fir.array_load and friends) that the array-value-copy pass legalizes, so the pass runs as a guaranteed no-op on every function. Remove it from the default pipeline (addAVC and the disable-avc mlir option); the pass itself and its fir-opt tests remain and still run via fir-opt --array-value-copy.

The array-value operations themselves and the pass are planned for removal in follow-up patches.

flang/test/Fir/arrexp.fir is deleted rather than updated: it feeds legacy array-value ops through tco's full pipeline, which no longer legalizes them (the ops have no codegen patterns), and the file exercises no live feature beyond that legalization.

Assisted-by: AI

>From 4dde3604f009d584a5e14dace56223d1031eca8c Mon Sep 17 00:00:00 2001
From: Eugene Epshteyn <eepshteyn at nvidia.com>
Date: Fri, 24 Jul 2026 09:27:26 -0400
Subject: [PATCH] [flang] Stop running array-value-copy in the default pipeline

Since the removal of the legacy expression lowering (#210385, #210621,
#210639, #210873), nothing in flang produces the array-value operations
(fir.array_load and friends) that the array-value-copy pass legalizes, so
the pass runs as a guaranteed no-op on every function. Remove it from the
default pipeline (addAVC and the disable-avc mlir option); the pass itself
and its fir-opt tests remain and still run via fir-opt --array-value-copy.

The array-value operations themselves and the pass are planned for removal
in follow-up patches.

flang/test/Fir/arrexp.fir is deleted rather than updated: it feeds legacy
array-value ops through tco's full pipeline, which no longer legalizes them
(the ops have no codegen patterns), and the file exercises no live feature
beyond that legalization.
---
 .../flang/Optimizer/Passes/CommandLineOpts.h  |   1 -
 .../flang/Optimizer/Passes/Pipelines.h        |   2 -
 .../lib/Optimizer/Passes/CommandLineOpts.cpp  |   1 -
 flang/lib/Optimizer/Passes/Pipelines.cpp      |   8 -
 flang/test/Driver/bbc-mlir-pass-pipeline.f90  |   1 -
 .../test/Driver/mlir-debug-pass-pipeline.f90  |   1 -
 flang/test/Driver/mlir-pass-pipeline.f90      |   1 -
 flang/test/Fir/arrexp.fir                     | 211 ------------------
 flang/test/Fir/basic-program.fir              |   1 -
 9 files changed, 227 deletions(-)
 delete mode 100644 flang/test/Fir/arrexp.fir

diff --git a/flang/include/flang/Optimizer/Passes/CommandLineOpts.h b/flang/include/flang/Optimizer/Passes/CommandLineOpts.h
index 882f02032a3b8..074f9c0a98e51 100644
--- a/flang/include/flang/Optimizer/Passes/CommandLineOpts.h
+++ b/flang/include/flang/Optimizer/Passes/CommandLineOpts.h
@@ -53,7 +53,6 @@ extern llvm::codegenoptions::DebugInfoKind noDebugInfo;
 /// Optimizer Passes
 extern llvm::cl::opt<bool> disableCfgConversion;
 extern llvm::cl::opt<bool> disableFirAliasTags;
-extern llvm::cl::opt<bool> disableFirAvc;
 extern llvm::cl::opt<bool> disableFirMao;
 extern llvm::cl::opt<bool> enableFirLICM;
 extern llvm::cl::opt<bool> useOldAliasTags;
diff --git a/flang/include/flang/Optimizer/Passes/Pipelines.h b/flang/include/flang/Optimizer/Passes/Pipelines.h
index 8d867612d405c..a824f4cd2050d 100644
--- a/flang/include/flang/Optimizer/Passes/Pipelines.h
+++ b/flang/include/flang/Optimizer/Passes/Pipelines.h
@@ -81,8 +81,6 @@ void addCanonicalizerPassWithoutRegionSimplification(mlir::OpPassManager &pm);
 void addCfgConversionPass(mlir::PassManager &pm,
                           const MLIRToLLVMPassPipelineConfig &config);
 
-void addAVC(mlir::PassManager &pm, const llvm::OptimizationLevel &optLevel);
-
 void addMemoryAllocationOpt(mlir::PassManager &pm);
 
 void addCodeGenRewritePass(mlir::PassManager &pm, bool preserveDeclare);
diff --git a/flang/lib/Optimizer/Passes/CommandLineOpts.cpp b/flang/lib/Optimizer/Passes/CommandLineOpts.cpp
index d461c1b9757b5..bb61916fcfcbb 100644
--- a/flang/lib/Optimizer/Passes/CommandLineOpts.cpp
+++ b/flang/lib/Optimizer/Passes/CommandLineOpts.cpp
@@ -51,7 +51,6 @@ codegenoptions::DebugInfoKind noDebugInfo{codegenoptions::NoDebugInfo};
 
 /// Optimizer Passes
 DisableOption(CfgConversion, "cfg-conversion", "disable FIR to CFG pass");
-DisableOption(FirAvc, "avc", "array value copy analysis and transformation");
 DisableOption(FirMao, "memory-allocation-opt",
               "memory allocation optimization");
 
diff --git a/flang/lib/Optimizer/Passes/Pipelines.cpp b/flang/lib/Optimizer/Passes/Pipelines.cpp
index 7fe8bccc14d54..a37fe8d157045 100644
--- a/flang/lib/Optimizer/Passes/Pipelines.cpp
+++ b/flang/lib/Optimizer/Passes/Pipelines.cpp
@@ -66,13 +66,6 @@ void addCfgConversionPass(mlir::PassManager &pm,
       pm, disableCfgConversion, [&]() { return createCFGConversion(options); });
 }
 
-void addAVC(mlir::PassManager &pm, const llvm::OptimizationLevel &optLevel) {
-  ArrayValueCopyOptions options;
-  options.optimizeConflicts = optLevel != llvm::OptimizationLevel::O0;
-  addNestedPassConditionally<mlir::func::FuncOp>(
-      pm, disableFirAvc, [&]() { return createArrayValueCopyPass(options); });
-}
-
 void addMemoryAllocationOpt(mlir::PassManager &pm) {
   addNestedPassConditionally<mlir::func::FuncOp>(pm, disableFirMao, [&]() {
     return fir::createMemoryAllocationOpt(
@@ -205,7 +198,6 @@ void createDefaultFIROptimizerPassPipeline(mlir::PassManager &pm,
   config.setRegionSimplificationLevel(
       mlir::GreedySimplifyRegionLevel::Disabled);
   pm.addPass(mlir::createCSEPass());
-  fir::addAVC(pm, pc.OptLevel);
   addNestedPassToAllTopLevelOperations<PassConstructor>(
       pm, fir::createCharacterConversion);
   pm.addPass(mlir::createCanonicalizerPass(config));
diff --git a/flang/test/Driver/bbc-mlir-pass-pipeline.f90 b/flang/test/Driver/bbc-mlir-pass-pipeline.f90
index 21697485a2a89..4c98c22b90e33 100644
--- a/flang/test/Driver/bbc-mlir-pass-pipeline.f90
+++ b/flang/test/Driver/bbc-mlir-pass-pipeline.f90
@@ -21,7 +21,6 @@
 ! CHECK-NEXT: 'fir.global' Pipeline
 ! CHECK-NEXT:   CharacterConversion
 ! CHECK-NEXT: 'func.func' Pipeline
-! CHECK-NEXT:   ArrayValueCopy
 ! CHECK-NEXT:   CharacterConversion
 ! CHECK-NEXT: 'omp.declare_mapper' Pipeline
 ! CHECK-NEXT:   CharacterConversion
diff --git a/flang/test/Driver/mlir-debug-pass-pipeline.f90 b/flang/test/Driver/mlir-debug-pass-pipeline.f90
index d5126012b6957..93c227ebfde74 100644
--- a/flang/test/Driver/mlir-debug-pass-pipeline.f90
+++ b/flang/test/Driver/mlir-debug-pass-pipeline.f90
@@ -60,7 +60,6 @@
 ! ALL-NEXT: 'fir.global' Pipeline
 ! ALL-NEXT:   CharacterConversion
 ! ALL-NEXT: 'func.func' Pipeline
-! ALL-NEXT:   ArrayValueCopy
 ! ALL-NEXT:   CharacterConversion
 ! ALL-NEXT: 'omp.declare_mapper' Pipeline
 ! ALL-NEXT:   CharacterConversion
diff --git a/flang/test/Driver/mlir-pass-pipeline.f90 b/flang/test/Driver/mlir-pass-pipeline.f90
index b679564adff10..dadf3ce28c66f 100644
--- a/flang/test/Driver/mlir-pass-pipeline.f90
+++ b/flang/test/Driver/mlir-pass-pipeline.f90
@@ -110,7 +110,6 @@
 ! ALL-NEXT: 'fir.global' Pipeline
 ! ALL-NEXT:   CharacterConversion
 ! ALL-NEXT: 'func.func' Pipeline
-! ALL-NEXT:   ArrayValueCopy
 ! ALL-NEXT:   CharacterConversion
 ! ALL-NEXT: 'omp.declare_mapper' Pipeline
 ! ALL-NEXT:   CharacterConversion
diff --git a/flang/test/Fir/arrexp.fir b/flang/test/Fir/arrexp.fir
deleted file mode 100644
index ff11e57a13175..0000000000000
--- a/flang/test/Fir/arrexp.fir
+++ /dev/null
@@ -1,211 +0,0 @@
-// RUN: tco %s | FileCheck %s
-
-// CHECK-LABEL: define void @f1
-// CHECK: (ptr {{[^%]*}}%[[A:[^,]*]], {{.*}}, float %[[F:.*]])
-func.func @f1(%a : !fir.ref<!fir.array<?x?xf32>>, %n : index, %m : index, %o : index, %p : index, %f : f32) {
-  %c1 = arith.constant 1 : index
-  %s = fir.shape_shift %o, %n, %p, %m : (index, index, index, index) -> !fir.shapeshift<2>
-  %vIn = fir.array_load %a(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
-  // CHECK: = icmp sgt
-  %r = fir.do_loop %j = %p to %m step %c1 iter_args(%v1 = %vIn) -> !fir.array<?x?xf32> {
-    // CHECK: = icmp sgt
-    %r = fir.do_loop %i = %o to %n step %c1 iter_args(%v = %v1) -> !fir.array<?x?xf32> {
-      // CHECK: %[[AOFF:.*]] = getelementptr nusw nuw float, ptr %[[A]], i64
-      // CHECK: store float %[[F]], ptr %[[AOFF]]
-      %r = fir.array_update %v, %f, %i, %j : (!fir.array<?x?xf32>, f32, index, index) -> !fir.array<?x?xf32>
-      fir.result %r : !fir.array<?x?xf32>
-    }
-    fir.result %r : !fir.array<?x?xf32>
-  }
-  fir.array_merge_store %vIn, %r to %a : !fir.array<?x?xf32>, !fir.array<?x?xf32>, !fir.ref<!fir.array<?x?xf32>>
-  // CHECK: ret void
-  return
-}
-
-// CHECK-LABEL: define void @f2
-// CHECK: (ptr {{[^%]*}}%[[A:[^,]*]], {{.*}}, float %[[F:.*]])
-func.func @f2(%a : !fir.ref<!fir.array<?x?xf32>>, %b : !fir.ref<!fir.array<?x?xf32>>, %n : index, %m : index, %o : index, %p : index, %f : f32) {
-  %c1 = arith.constant 1 : index
-  %s = fir.shape_shift %o, %n, %p, %m : (index, index, index, index) -> !fir.shapeshift<2>
-  %vIn = fir.array_load %a(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
-  %wIn = fir.array_load %b(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
-  // CHECK: = icmp sgt
-  %r = fir.do_loop %j = %p to %m step %c1 iter_args(%v1 = %vIn) -> !fir.array<?x?xf32> {
-    // CHECK: = icmp sgt
-    %r = fir.do_loop %i = %o to %n step %c1 iter_args(%v = %v1) -> !fir.array<?x?xf32> {
-      %x = fir.array_fetch %wIn, %i, %j : (!fir.array<?x?xf32>, index, index) -> f32
-      %y = arith.addf %x, %f : f32
-      // CHECK: %[[AOFF:.*]] = getelementptr nusw nuw float, ptr %[[A]], i64
-      %r = fir.array_update %v, %y, %i, %j : (!fir.array<?x?xf32>, f32, index, index) -> !fir.array<?x?xf32>
-      fir.result %r : !fir.array<?x?xf32>
-    }
-    fir.result %r : !fir.array<?x?xf32>
-  }
-  fir.array_merge_store %vIn, %r to %a : !fir.array<?x?xf32>, !fir.array<?x?xf32>, !fir.ref<!fir.array<?x?xf32>>
-  // CHECK: ret void
-  return
-}
-
-// CHECK-LABEL: define void @f3
-// CHECK: (ptr {{[^%]*}}%[[A:[^,]*]], {{.*}}, float %[[F:.*]])
-func.func @f3(%a : !fir.ref<!fir.array<?x?xf32>>, %b : !fir.ref<!fir.array<?x?xf32>>, %n : index, %m : index, %o : index, %p : index, %f : f32) {
-  %c1 = arith.constant 1 : index
-  %s = fir.shape_shift %o, %n, %p, %m : (index, index, index, index) -> !fir.shapeshift<2>
-  %vIn = fir.array_load %a(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
-  %wIn = fir.array_load %b(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
-  // CHECK: = icmp sgt
-  %r = fir.do_loop %j = %p to %m step %c1 iter_args(%v1 = %vIn) -> !fir.array<?x?xf32> {
-    // CHECK: = icmp sgt
-    %r = fir.do_loop %i = %o to %n step %c1 iter_args(%v = %v1) -> !fir.array<?x?xf32> {
-      %x = fir.array_fetch %wIn, %i, %j : (!fir.array<?x?xf32>, index, index) -> f32
-      %y = arith.addf %x, %f : f32
-      // CHECK: %[[AOFF:.*]] = getelementptr nusw nuw float, ptr %[[A]], i64
-      %i2 = arith.addi %i, %c1 : index
-      %r = fir.array_update %v, %y, %i2, %j : (!fir.array<?x?xf32>, f32, index, index) -> !fir.array<?x?xf32>
-      fir.result %r : !fir.array<?x?xf32>
-    }
-    fir.result %r : !fir.array<?x?xf32>
-  }
-  fir.array_merge_store %vIn, %r to %a : !fir.array<?x?xf32>, !fir.array<?x?xf32>, !fir.ref<!fir.array<?x?xf32>>
-  // CHECK: ret void
-  return
-}
-
-// CHECK-LABEL: define void @f4
-// CHECK: (ptr {{[^%]*}}%[[A:[^,]*]], {{.*}}, float %[[F:.*]])
-func.func @f4(%a : !fir.ref<!fir.array<?x?xf32>>, %b : !fir.ref<!fir.array<?x?xf32>>, %n : index, %m : index, %o : index, %p : index, %f : f32) {
-  %c1 = arith.constant 1 : index
-  %s = fir.shape_shift %o, %n, %p, %m : (index, index, index, index) -> !fir.shapeshift<2>
-  %vIn = fir.array_load %a(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
-  %wIn = fir.array_load %b(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.array<?x?xf32>
-  // CHECK: = icmp sgt
-  %r = fir.do_loop %j = %p to %m step %c1 iter_args(%v1 = %vIn) -> !fir.array<?x?xf32> {
-    // CHECK: = icmp sgt
-    %r = fir.do_loop %i = %o to %n step %c1 iter_args(%v = %v1) -> !fir.array<?x?xf32> {
-      %x2 = fir.array_fetch %vIn, %i, %j : (!fir.array<?x?xf32>, index, index) -> f32
-      %x = fir.array_fetch %wIn, %i, %j : (!fir.array<?x?xf32>, index, index) -> f32
-      %y = arith.addf %x, %f : f32
-      %y2 = arith.addf %y, %x2 : f32
-      // CHECK: %[[AOFF:.*]] = getelementptr nusw nuw float, ptr %[[A]], i64
-      %i2 = arith.addi %i, %c1 : index
-      %r = fir.array_update %v, %y2, %i2, %j : (!fir.array<?x?xf32>, f32, index, index) -> !fir.array<?x?xf32>
-      fir.result %r : !fir.array<?x?xf32>
-    }
-    fir.result %r : !fir.array<?x?xf32>
-  }
-  fir.array_merge_store %vIn, %r to %a : !fir.array<?x?xf32>, !fir.array<?x?xf32>, !fir.ref<!fir.array<?x?xf32>>
-  // CHECK: ret void
-  return
-}
-
-// Array expression assignment with potentially non contiguous arrays (e.g.
-// `a = b + f`, with and v assumed shapes.
-// Tests that the stride from the descriptor is used.
-// CHECK-LABEL: define void @f5
-// CHECK: (ptr {{[^%]*}}%[[A:.*]], ptr {{[^%]*}}%[[B:.*]], float %[[F:.*]])
-func.func @f5(%arg0: !fir.box<!fir.array<?xf32>>, %arg1: !fir.box<!fir.array<?xf32>>, %arg2: f32) {
-  %c0 = arith.constant 0 : index
-  %c1 = arith.constant 1 : index
-  %0:3 = fir.box_dims %arg0, %c0 : (!fir.box<!fir.array<?xf32>>, index) -> (index, index, index)
-  %1 = arith.subi %0#1, %c1 : index
-  %2 = fir.array_load %arg0 : (!fir.box<!fir.array<?xf32>>) -> !fir.array<?xf32>
-  %3 = fir.array_load %arg1 : (!fir.box<!fir.array<?xf32>>) -> !fir.array<?xf32>
-  // CHECK: icmp sgt
-  %4 = fir.do_loop %arg3 = %c0 to %1 step %c1 iter_args(%arg4 = %2) -> (!fir.array<?xf32>) {
-    // CHECK: %[[B_STRIDE_GEP:.*]] = getelementptr {{.*}}, ptr %[[B]], i32 0, i32 7, i32 0, i32 2
-    // CHECK: %[[B_STRIDE:.*]] = load i64, ptr %[[B_STRIDE_GEP]]
-    // CHECK: %[[B_DIM_OFFSET:.*]] = mul nsw i64 %{{.*}}, %[[B_STRIDE]]
-    // CHECK: %[[B_OFFSET:.*]] =  add nsw i64 %[[B_DIM_OFFSET]], 0
-    // CHECK: %[[B_BASE_GEP:.*]] = getelementptr {{.*}}, ptr %{{.*}}, i32 0, i32 0
-    // CHECK: %[[B_BASE:.*]] = load ptr, ptr %[[B_BASE_GEP]]
-    // CHECK: %[[B_VOID_ADDR:.*]] = getelementptr nusw i8, ptr %[[B_BASE]], i64 %[[B_OFFSET]]
-    // CHECK: %[[B_VAL:.*]] = load float, ptr %[[B_VOID_ADDR]]
-    // CHECK: fadd float %[[B_VAL]], %[[F]]
-    %5 = fir.array_fetch %3, %arg3 : (!fir.array<?xf32>, index) -> f32
-    %6 = arith.addf %5, %arg2 : f32
-    %7 = fir.array_update %arg4, %6, %arg3 : (!fir.array<?xf32>, f32, index) -> !fir.array<?xf32>
-    fir.result %7 : !fir.array<?xf32>
-  }
-  fir.array_merge_store %2, %4 to %arg0 : !fir.array<?xf32>, !fir.array<?xf32>, !fir.box<!fir.array<?xf32>>
-  // CHECK: ret void
-  return
-}
-
-// Overlapping array expression assignment with a potentially non
-// contiguous array (e.g. `a(2:10:1) = a(1:9:1) + f`, with a assumed shape).
-// Test that a temp is created.
-// CHECK-LABEL: define void @f6
-// CHECK: (ptr {{[^%]*}}%[[A:[^,]*]], float %[[F:.*]])
-func.func @f6(%arg0: !fir.box<!fir.array<?xf32>>, %arg1: f32) {
-  %c0 = arith.constant 0 : index
-  %c1 = arith.constant 1 : index
-  %c2 = arith.constant 2 : index
-  %c9 = arith.constant 9 : index
-  %c10 = arith.constant 10 : index
-
-  // CHECK: %[[EXT_GEP:.*]] = getelementptr {{.*}} %[[A]], i32 0, i32 7, i64 0, i32 1
-  // CHECK: %[[EXTENT:.*]] = load i64, ptr %[[EXT_GEP]]
-  // CHECK: %[[SIZE:.*]] = mul i64 4, %[[EXTENT]]
-  // CHECK: %[[CMP:.*]] = icmp sgt i64 %[[SIZE]], 0
-  // CHECK: %[[SZ:.*]] = select i1 %[[CMP]], i64 %[[SIZE]], i64 1
-  // CHECK: %[[MALLOC:.*]] = call ptr @malloc(i64 %[[SZ]])
-  %1 = fir.slice %c2, %c10, %c1 : (index, index, index) -> !fir.slice<1>
-  %2 = fir.array_load %arg0 [%1] : (!fir.box<!fir.array<?xf32>>, !fir.slice<1>) -> !fir.array<?xf32>
-  %3 = fir.slice %c1, %c9, %c1 : (index, index, index) -> !fir.slice<1>
-  %4 = fir.array_load %arg0 [%3] : (!fir.box<!fir.array<?xf32>>, !fir.slice<1>) -> !fir.array<?xf32>
-  %5 = fir.do_loop %arg2 = %c0 to %c9 step %c1 iter_args(%arg3 = %2) -> (!fir.array<?xf32>) {
-    %6 = fir.array_fetch %4, %arg2 : (!fir.array<?xf32>, index) -> f32
-    %7 = arith.addf %6, %arg1 : f32
-    %8 = fir.array_update %arg3, %7, %arg2 : (!fir.array<?xf32>, f32, index) -> !fir.array<?xf32>
-    fir.result %8 : !fir.array<?xf32>
-  }
-  fir.array_merge_store %2, %5 to %arg0[%1] : !fir.array<?xf32>, !fir.array<?xf32>, !fir.box<!fir.array<?xf32>>, !fir.slice<1>
-  // CHECK: ret void
-  return
-}
-
-// Non contiguous array with lower bounds (x = y(100), with y(4:))
-// Test array_coor offset computation.
-// CHECK-LABEL:  define void @f7(
-// CHECK: ptr {{[^%]*}}%[[X:[^,]*]], ptr {{[^%]*}}%[[Y:.*]])
-func.func @f7(%arg0: !fir.ref<f32>, %arg1: !fir.box<!fir.array<?xf32>>) {
-  %c4 = arith.constant 4 : index
-  %c100 = arith.constant 100 : index
-  %0 = fir.shift %c4 : (index) -> !fir.shift<1>
-  // CHECK: %[[STRIDE_GEP:.*]] = getelementptr {{.*}}, ptr %[[Y]], i32 0, i32 7, i32 0, i32 2
-  // CHECK: %[[STRIDE:.*]] = load i64, ptr %[[STRIDE_GEP]]
-  // CHECK: mul nsw i64 96, %[[STRIDE]]
-  %1 = fir.array_coor %arg1(%0) %c100 : (!fir.box<!fir.array<?xf32>>, !fir.shift<1>, index) -> !fir.ref<f32>
-  %2 = fir.load %1 : !fir.ref<f32>
-  fir.store %2 to %arg0 : !fir.ref<f32>
-  return
-} 
-
-// Test A(:, :)%x reference codegen with A constant shape.
-// CHECK-LABEL:  define void @f8(
-// CHECK-SAME: ptr {{[^%]*}}%[[A:.*]], i32 %[[I:.*]])
-func.func @f8(%a : !fir.ref<!fir.array<2x2x!fir.type<t{i:i32}>>>, %i : i32) {
-  %c0 = arith.constant 0 : index
-  %c1 = arith.constant 1 : index
-  %c2 = arith.constant 2 : index
-  %1 = fir.field_index i, !fir.type<t{i:i32}>
-  %2 = fir.shape %c2, %c2 : (index, index) -> !fir.shape<2>
-  %3 = fir.slice %c1, %c2, %c1, %c1, %c2, %c1 path %1 : (index, index, index, index, index, index, !fir.field) -> !fir.slice<2>
-  // CHECK: %[[GEP:.*]] = getelementptr nusw nuw %t, ptr %[[A]], i64 0, i32 0
-  %4 = fir.array_coor %a(%2) [%3] %c1, %c1 : (!fir.ref<!fir.array<2x2x!fir.type<t{i:i32}>>>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref<i32>
-  // CHECK: store i32 %[[I]], ptr %[[GEP]], align 4
-  fir.store %i to %4 : !fir.ref<i32>
-  return
-}
-
-// Test casts in in array_coor offset computation when type parameters are not i64
-// CHECK-LABEL: define ptr @f9(
-// CHECK-SAME: i32 %[[I:.*]], i64 %{{.*}}, i64 %{{.*}}, ptr {{[^%]*}}%[[C:.*]])
-func.func @f9(%i: i32, %e : i64, %j: i64, %c: !fir.ref<!fir.array<?x?x!fir.char<1,?>>>) -> !fir.ref<!fir.char<1,?>> {
-  %s = fir.shape %e, %e : (i64, i64) -> !fir.shape<2>
-  // CHECK: %[[CAST:.*]] = sext i32 %[[I]] to i64
-  // CHECK: %[[OFFSET:.*]] = mul nuw nsw i64 %{{.*}}, %[[CAST]]
-  // CHECK: getelementptr nusw nuw i8, ptr %[[C]], i64 %[[OFFSET]]
-  %a = fir.array_coor %c(%s) %j, %j typeparams %i : (!fir.ref<!fir.array<?x?x!fir.char<1,?>>>, !fir.shape<2>, i64, i64, i32) -> !fir.ref<!fir.char<1,?>>
-  return %a :  !fir.ref<!fir.char<1,?>>
-}
diff --git a/flang/test/Fir/basic-program.fir b/flang/test/Fir/basic-program.fir
index 14dea7818f230..d1e7cdb44d0c7 100644
--- a/flang/test/Fir/basic-program.fir
+++ b/flang/test/Fir/basic-program.fir
@@ -93,7 +93,6 @@ func.func @_QQmain() {
 // PASSES-NEXT: 'fir.global' Pipeline
 // PASSES-NEXT:   CharacterConversion
 // PASSES-NEXT: 'func.func' Pipeline
-// PASSES-NEXT:   ArrayValueCopy
 // PASSES-NEXT:   CharacterConversion
 // PASSES-NEXT: 'omp.declare_mapper' Pipeline
 // PASSES-NEXT:   CharacterConversion



More information about the flang-commits mailing list