[flang-commits] [flang] [flang][NFC] Converted five tests from old lowering to new lowering (part 41) (PR #190575)

via flang-commits flang-commits at lists.llvm.org
Sun Apr 5 20:54:15 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-fir-hlfir

Author: Eugene Epshteyn (eugeneepshteyn)

<details>
<summary>Changes</summary>

Tests converted from test/Lower/Intrinsics: shifta.f90, shiftl.f90, shiftr.f90, size.f90, spread.f90

---

Patch is 33.74 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/190575.diff


5 Files Affected:

- (modified) flang/test/Lower/Intrinsics/shifta.f90 (+36-17) 
- (modified) flang/test/Lower/Intrinsics/shiftl.f90 (+31-12) 
- (modified) flang/test/Lower/Intrinsics/shiftr.f90 (+31-12) 
- (modified) flang/test/Lower/Intrinsics/size.f90 (+53-62) 
- (modified) flang/test/Lower/Intrinsics/spread.f90 (+18-15) 


``````````diff
diff --git a/flang/test/Lower/Intrinsics/shifta.f90 b/flang/test/Lower/Intrinsics/shifta.f90
index ac72c535460ff..009fb6f5db66b 100644
--- a/flang/test/Lower/Intrinsics/shifta.f90
+++ b/flang/test/Lower/Intrinsics/shifta.f90
@@ -1,5 +1,4 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
 
 ! CHECK-LABEL: shifta1_test
 ! CHECK-SAME: %[[A:.*]]: !fir.ref<i8>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i8>{{.*}}
@@ -8,8 +7,11 @@ subroutine shifta1_test(a, b, c)
   integer :: b
   integer(kind=1) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i8>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i8>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shifta(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 8 : i8
   ! CHECK: %[[B_CONV:.*]] = fir.convert %[[B_VAL]] : (i32) -> i8
@@ -19,7 +21,8 @@ subroutine shifta1_test(a, b, c)
   ! CHECK: %[[IS_NEG:.*]] = arith.cmpi slt, %[[A_VAL]], %[[C0]] : i8
   ! CHECK: %[[RES:.*]] = arith.select %[[IS_NEG]], %[[CM1]], %[[C0]] : i8
   ! CHECK: %[[SHIFTED:.*]] = arith.shrsi %[[A_VAL]], %[[B_CONV]] : i8
-  ! CHECK: %{{.*}} = arith.select %[[SHIFT_IS_BITWIDTH]], %[[RES]], %[[SHIFTED]] : i8
+  ! CHECK: %[[SEL:.*]] = arith.select %[[SHIFT_IS_BITWIDTH]], %[[RES]], %[[SHIFTED]] : i8
+  ! CHECK: hlfir.assign %[[SEL]] to %[[C_DECL]]#0 : i8, !fir.ref<i8>
 end subroutine shifta1_test
 
 ! CHECK-LABEL: shifta2_test
@@ -29,8 +32,11 @@ subroutine shifta2_test(a, b, c)
   integer :: b
   integer(kind=2) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i16>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i16>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shifta(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 16 : i16
   ! CHECK: %[[B_CONV:.*]] = fir.convert %[[B_VAL]] : (i32) -> i16
@@ -40,7 +46,8 @@ subroutine shifta2_test(a, b, c)
   ! CHECK: %[[IS_NEG:.*]] = arith.cmpi slt, %[[A_VAL]], %[[C0]] : i16
   ! CHECK: %[[RES:.*]] = arith.select %[[IS_NEG]], %[[CM1]], %[[C0]] : i16
   ! CHECK: %[[SHIFTED:.*]] = arith.shrsi %[[A_VAL]], %[[B_CONV]] : i16
-  ! CHECK: %{{.*}} = arith.select %[[SHIFT_IS_BITWIDTH]], %[[RES]], %[[SHIFTED]] : i16
+  ! CHECK: %[[SEL:.*]] = arith.select %[[SHIFT_IS_BITWIDTH]], %[[RES]], %[[SHIFTED]] : i16
+  ! CHECK: hlfir.assign %[[SEL]] to %[[C_DECL]]#0 : i16, !fir.ref<i16>
 end subroutine shifta2_test
 
 ! CHECK-LABEL: shifta4_test
@@ -50,8 +57,11 @@ subroutine shifta4_test(a, b, c)
   integer :: b
   integer(kind=4) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i32>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i32>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shifta(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 32 : i32
   ! CHECK: %[[SHIFT_IS_BITWIDTH:.*]] = arith.cmpi uge, %[[B_VAL]], %[[C_BITS]] : i32
@@ -60,7 +70,8 @@ subroutine shifta4_test(a, b, c)
   ! CHECK: %[[IS_NEG:.*]] = arith.cmpi slt, %[[A_VAL]], %[[C0]] : i32
   ! CHECK: %[[RES:.*]] = arith.select %[[IS_NEG]], %[[CM1]], %[[C0]] : i32
   ! CHECK: %[[SHIFTED:.*]] = arith.shrsi %[[A_VAL]], %[[B_VAL]] : i32
-  ! CHECK: %{{.*}} = arith.select %[[SHIFT_IS_BITWIDTH]], %[[RES]], %[[SHIFTED]] : i32
+  ! CHECK: %[[SEL:.*]] = arith.select %[[SHIFT_IS_BITWIDTH]], %[[RES]], %[[SHIFTED]] : i32
+  ! CHECK: hlfir.assign %[[SEL]] to %[[C_DECL]]#0 : i32, !fir.ref<i32>
 end subroutine shifta4_test
 
 ! CHECK-LABEL: shifta8_test
@@ -70,8 +81,11 @@ subroutine shifta8_test(a, b, c)
   integer :: b
   integer(kind=8) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i64>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i64>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shifta(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 64 : i64
   ! CHECK: %[[B_CONV:.*]] = fir.convert %[[B_VAL]] : (i32) -> i64
@@ -81,7 +95,8 @@ subroutine shifta8_test(a, b, c)
   ! CHECK: %[[IS_NEG:.*]] = arith.cmpi slt, %[[A_VAL]], %[[C0]] : i64
   ! CHECK: %[[RES:.*]] = arith.select %[[IS_NEG]], %[[CM1]], %[[C0]] : i64
   ! CHECK: %[[SHIFTED:.*]] = arith.shrsi %[[A_VAL]], %[[B_CONV]] : i64
-  ! CHECK: %{{.*}} = arith.select %[[SHIFT_IS_BITWIDTH]], %[[RES]], %[[SHIFTED]] : i64
+  ! CHECK: %[[SEL:.*]] = arith.select %[[SHIFT_IS_BITWIDTH]], %[[RES]], %[[SHIFTED]] : i64
+  ! CHECK: hlfir.assign %[[SEL]] to %[[C_DECL]]#0 : i64, !fir.ref<i64>
 end subroutine shifta8_test
 
 ! CHECK-LABEL: shifta16_test
@@ -91,8 +106,11 @@ subroutine shifta16_test(a, b, c)
   integer :: b
   integer(kind=16) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i128>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i128>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shifta(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 128 : i128
   ! CHECK: %[[B_CONV:.*]] = fir.convert %[[B_VAL]] : (i32) -> i128
@@ -102,5 +120,6 @@ subroutine shifta16_test(a, b, c)
   ! CHECK: %[[IS_NEG:.*]] = arith.cmpi slt, %[[A_VAL]], %[[C0]] : i128
   ! CHECK: %[[RES:.*]] = arith.select %[[IS_NEG]], %[[CM1]], %[[C0]] : i128
   ! CHECK: %[[SHIFTED:.*]] = arith.shrsi %[[A_VAL]], %[[B_CONV]] : i128
-  ! CHECK: %{{.*}} = arith.select %[[SHIFT_IS_BITWIDTH]], %[[RES]], %[[SHIFTED]] : i128
+  ! CHECK: %[[SEL:.*]] = arith.select %[[SHIFT_IS_BITWIDTH]], %[[RES]], %[[SHIFTED]] : i128
+  ! CHECK: hlfir.assign %[[SEL]] to %[[C_DECL]]#0 : i128, !fir.ref<i128>
 end subroutine shifta16_test
diff --git a/flang/test/Lower/Intrinsics/shiftl.f90 b/flang/test/Lower/Intrinsics/shiftl.f90
index 846072734959a..8e1f7cd88607d 100644
--- a/flang/test/Lower/Intrinsics/shiftl.f90
+++ b/flang/test/Lower/Intrinsics/shiftl.f90
@@ -1,5 +1,4 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
 
 ! CHECK-LABEL: shiftl1_test
 ! CHECK-SAME: %[[A:.*]]: !fir.ref<i8>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i8>{{.*}}
@@ -8,8 +7,11 @@ subroutine shiftl1_test(a, b, c)
   integer :: b
   integer(kind=1) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i8>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i8>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shiftl(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 8 : i8
   ! CHECK: %[[C_0:.*]] = arith.constant 0 : i8
@@ -19,6 +21,7 @@ subroutine shiftl1_test(a, b, c)
   ! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
   ! CHECK: %[[SHIFT:.*]] = arith.shli %[[A_VAL]], %[[B_CONV]] : i8
   ! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i8
+  ! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i8, !fir.ref<i8>
 end subroutine shiftl1_test
 
 ! CHECK-LABEL: shiftl2_test
@@ -28,8 +31,11 @@ subroutine shiftl2_test(a, b, c)
   integer :: b
   integer(kind=2) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i16>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i16>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shiftl(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 16 : i16
   ! CHECK: %[[C_0:.*]] = arith.constant 0 : i16
@@ -39,6 +45,7 @@ subroutine shiftl2_test(a, b, c)
   ! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
   ! CHECK: %[[SHIFT:.*]] = arith.shli %[[A_VAL]], %[[B_CONV]] : i16
   ! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i16
+  ! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i16, !fir.ref<i16>
 end subroutine shiftl2_test
 
 ! CHECK-LABEL: shiftl4_test
@@ -48,8 +55,11 @@ subroutine shiftl4_test(a, b, c)
   integer :: b
   integer(kind=4) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i32>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i32>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shiftl(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 32 : i32
   ! CHECK: %[[C_0:.*]] = arith.constant 0 : i32
@@ -58,6 +68,7 @@ subroutine shiftl4_test(a, b, c)
   ! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
   ! CHECK: %[[SHIFT:.*]] = arith.shli %[[A_VAL]], %[[B_VAL]] : i32
   ! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i32
+  ! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i32, !fir.ref<i32>
 end subroutine shiftl4_test
 
 ! CHECK-LABEL: shiftl8_test
@@ -67,8 +78,11 @@ subroutine shiftl8_test(a, b, c)
   integer :: b
   integer(kind=8) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i64>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i64>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shiftl(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 64 : i64
   ! CHECK: %[[C_0:.*]] = arith.constant 0 : i64
@@ -78,6 +92,7 @@ subroutine shiftl8_test(a, b, c)
   ! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
   ! CHECK: %[[SHIFT:.*]] = arith.shli %[[A_VAL]], %[[B_CONV]] : i64
   ! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i64
+  ! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i64, !fir.ref<i64>
 end subroutine shiftl8_test
 
 ! CHECK-LABEL: shiftl16_test
@@ -87,8 +102,11 @@ subroutine shiftl16_test(a, b, c)
   integer :: b
   integer(kind=16) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i128>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i128>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shiftl(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 128 : i128
   ! CHECK: %[[C_0:.*]] = arith.constant 0 : i128
@@ -98,4 +116,5 @@ subroutine shiftl16_test(a, b, c)
   ! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
   ! CHECK: %[[SHIFT:.*]] = arith.shli %[[A_VAL]], %[[B_CONV]] : i128
   ! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i128
+  ! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i128, !fir.ref<i128>
 end subroutine shiftl16_test
diff --git a/flang/test/Lower/Intrinsics/shiftr.f90 b/flang/test/Lower/Intrinsics/shiftr.f90
index e6c62845c2039..48ff93f1a6411 100644
--- a/flang/test/Lower/Intrinsics/shiftr.f90
+++ b/flang/test/Lower/Intrinsics/shiftr.f90
@@ -1,5 +1,4 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
 
 ! CHECK-LABEL: shiftr1_test
 ! CHECK-SAME: %[[A:.*]]: !fir.ref<i8>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i8>{{.*}}
@@ -8,8 +7,11 @@ subroutine shiftr1_test(a, b, c)
   integer :: b
   integer(kind=1) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i8>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i8>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shiftr(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 8 : i8
   ! CHECK: %[[C_0:.*]] = arith.constant 0 : i8
@@ -19,6 +21,7 @@ subroutine shiftr1_test(a, b, c)
   ! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
   ! CHECK: %[[SHIFT:.*]] = arith.shrui %[[A_VAL]], %[[B_CONV]] : i8
   ! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i8
+  ! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i8, !fir.ref<i8>
 end subroutine shiftr1_test
 
 ! CHECK-LABEL: shiftr2_test
@@ -28,8 +31,11 @@ subroutine shiftr2_test(a, b, c)
   integer :: b
   integer(kind=2) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i16>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i16>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shiftr(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 16 : i16
   ! CHECK: %[[C_0:.*]] = arith.constant 0 : i16
@@ -39,6 +45,7 @@ subroutine shiftr2_test(a, b, c)
   ! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
   ! CHECK: %[[SHIFT:.*]] = arith.shrui %[[A_VAL]], %[[B_CONV]] : i16
   ! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i16
+  ! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i16, !fir.ref<i16>
 end subroutine shiftr2_test
 
 ! CHECK-LABEL: shiftr4_test
@@ -48,8 +55,11 @@ subroutine shiftr4_test(a, b, c)
   integer :: b
   integer(kind=4) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i32>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i32>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shiftr(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 32 : i32
   ! CHECK: %[[C_0:.*]] = arith.constant 0 : i32
@@ -58,6 +68,7 @@ subroutine shiftr4_test(a, b, c)
   ! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
   ! CHECK: %[[SHIFT:.*]] = arith.shrui %[[A_VAL]], %[[B_VAL]] : i32
   ! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i32
+  ! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i32, !fir.ref<i32>
 end subroutine shiftr4_test
 
 ! CHECK-LABEL: shiftr8_test
@@ -67,8 +78,11 @@ subroutine shiftr8_test(a, b, c)
   integer :: b
   integer(kind=8) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i64>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i64>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shiftr(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 64 : i64
   ! CHECK: %[[C_0:.*]] = arith.constant 0 : i64
@@ -78,6 +92,7 @@ subroutine shiftr8_test(a, b, c)
   ! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
   ! CHECK: %[[SHIFT:.*]] = arith.shrui %[[A_VAL]], %[[B_CONV]] : i64
   ! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i64
+  ! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i64, !fir.ref<i64>
 end subroutine shiftr8_test
 
 ! CHECK-LABEL: shiftr16_test
@@ -87,8 +102,11 @@ subroutine shiftr16_test(a, b, c)
   integer :: b
   integer(kind=16) :: c
 
-  ! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i128>
-  ! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32>
+  ! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
+  ! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
+  ! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
+  ! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i128>
+  ! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
   c = shiftr(a, b)
   ! CHECK: %[[C_BITS:.*]] = arith.constant 128 : i128
   ! CHECK: %[[C_0:.*]] = arith.constant 0 : i128
@@ -98,4 +116,5 @@ subroutine shiftr16_test(a, b, c)
   ! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
   ! CHECK: %[[SHIFT:.*]] = arith.shrui %[[A_VAL]], %[[B_CONV]] : i128
   ! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i128
+  ! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i128, !fir.ref<i128>
 end subroutine shiftr16_test
diff --git a/flang/test/Lower/Intrinsics/size.f90 b/flang/test/Lower/Intrinsics/size.f90
index 36fb462472570..e0c2922c0251f 100644
--- a/flang/test/Lower/Intrinsics/size.f90
+++ b/flang/test/Lower/Intrinsics/size.f90
@@ -1,48 +1,33 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
 
 ! CHECK-LABEL: func @_QPsize_test() {
 subroutine size_test()
   real, dimension(1:10, -10:10) :: a
   integer :: dim = 1
   integer :: iSize
-! CHECK:         %[[VAL_c1:.*]] = arith.constant 1 : index
-! CHECK:         %[[VAL_c10:.*]] = arith.constant 10 : index
-! CHECK:         %[[VAL_cneg10:.*]] = arith.constant -10 : index
-! CHECK:         %[[VAL_c21:.*]] = arith.constant 21 : index
 ! CHECK:         %[[VAL_0:.*]] = fir.alloca !fir.array<10x21xf32> {bindc_name = "a", uniq_name = "_QFsize_testEa"}
-! CHECK:         %[[VAL_1:.*]] = fir.address_of(@_QFsize_testEdim) : !fir.ref<i32>
-! CHECK:         %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "isize", uniq_name = "_QFsize_testEisize"}
-! CHECK:         %[[VAL_c2_i64:.*]] = arith.constant 2 : i64
-! CHECK:         %[[VAL_3:.*]] = fir.convert %[[VAL_c2_i64]] : (i64) -> index
-! CHECK:         %[[VAL_c1_i64:.*]] = arith.constant 1 : i64
-! CHECK:         %[[VAL_4:.*]] = fir.convert %[[VAL_c1_i64]] : (i64) -> index
-! CHECK:         %[[VAL_c5_i64:.*]] = arith.constant 5 : i64
-! CHECK:         %[[VAL_5:.*]] = fir.convert %[[VAL_c5_i64]] : (i64) -> index
-! CHECK:         %[[VAL_neg1_i64:.*]] = arith.constant -1 : i64
-! CHECK:         %[[VAL_6:.*]] = fir.convert %[[VAL_neg1_i64]] : (i64) -> index
-! CHECK:         %[[VAL_c1_i64_0:.*]] = arith.constant 1 : i64
-! CHECK:         %[[VAL_7:.*]] = fir.convert %[[VAL_c1_i64_0]] : (i64) -> index
-! CHECK:         %[[VAL_c1_i64_1:.*]] = arith.constant 1 : i64
-! CHECK:         %[[VAL_8:.*]] = fir.convert %[[VAL_c1_i64_1]] : (i64) -> index
-! CHECK:         %[[VAL_9:.*]] = fir.shape_shift %[[VAL_c1]], %[[VAL_c10]], %[[VAL_cneg10]], %[[VAL_c21]] : (index, index, index, index) -> !fir.shapeshift<...
[truncated]

``````````

</details>


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


More information about the flang-commits mailing list