[flang-commits] [flang] [flang] Use CHECK-DAG to check constants (NFC) (PR #183687)

via flang-commits flang-commits at lists.llvm.org
Thu Feb 26 22:03:52 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

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

Author: lonely eagle (linuxlonelyeagle)

<details>
<summary>Changes</summary>

It is part of https://github.com/llvm/llvm-project/pull/180556, as a separate NFC PR

---
Full diff: https://github.com/llvm/llvm-project/pull/183687.diff


2 Files Affected:

- (modified) flang/test/Lower/HLFIR/goto-do-body.f90 (+3-3) 
- (modified) flang/test/Lower/volatile3.f90 (+4-4) 


``````````diff
diff --git a/flang/test/Lower/HLFIR/goto-do-body.f90 b/flang/test/Lower/HLFIR/goto-do-body.f90
index 45e4ef66ab639..05b666919c4c7 100644
--- a/flang/test/Lower/HLFIR/goto-do-body.f90
+++ b/flang/test/Lower/HLFIR/goto-do-body.f90
@@ -6,9 +6,9 @@ subroutine sub1()
   implicit none
   integer :: i
   external foo
-! CHECK:    %[[C2:.*]] = arith.constant 2 : i32
-! CHECK:    %[[C0:.*]] = arith.constant 0 : i32
-! CHECK:    %[[C1:.*]] = arith.constant 1 : i32
+! CHECK-DAG:    %[[C2:.*]] = arith.constant 2 : i32
+! CHECK-DAG:    %[[C0:.*]] = arith.constant 0 : i32
+! CHECK-DAG:    %[[C1:.*]] = arith.constant 1 : i32
 ! CHECK:    %[[TRIP:.*]] = fir.alloca i32
 ! CHECK:    %[[I_REF:.*]] = fir.alloca i32 {bindc_name = "i", {{.*}}}
 ! CHECK:    %[[I:.*]]:2 = hlfir.declare %[[I_REF]] {uniq_name = "_QFsub1Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
diff --git a/flang/test/Lower/volatile3.f90 b/flang/test/Lower/volatile3.f90
index d5eaa8ee8f752..06bcbfeee42fa 100644
--- a/flang/test/Lower/volatile3.f90
+++ b/flang/test/Lower/volatile3.f90
@@ -237,10 +237,10 @@ subroutine sub_select_rank(arr)
 
 ! CHECK-LABEL:   func.func private @_QFPsub_select_rank(
 ! CHECK-SAME:      %[[ARG0:.*]]: !fir.box<!fir.array<*:i32>> {fir.bindc_name = "arr"}) {{.*}} {
-! CHECK:           %[[CONSTANT_0:.*]] = arith.constant 1 : index
-! CHECK:           %[[CONSTANT_1:.*]] = arith.constant 5 : i32
-! CHECK:           %[[CONSTANT_2:.*]] = arith.constant 4 : i8
-! CHECK:           %[[CONSTANT_3:.*]] = arith.constant 1 : i8
+! CHECK-DAG:       %[[CONSTANT_0:.*]] = arith.constant 1 : index
+! CHECK-DAG:       %[[CONSTANT_1:.*]] = arith.constant 5 : i32
+! CHECK-DAG:       %[[CONSTANT_2:.*]] = arith.constant 4 : i8
+! CHECK-DAG:       %[[CONSTANT_3:.*]] = arith.constant 1 : i8
 ! CHECK:           %[[DUMMY_SCOPE_0:.*]] = fir.dummy_scope : !fir.dscope
 ! CHECK:           %[[VOLATILE_CAST_0:.*]] = fir.volatile_cast %[[ARG0]] : (!fir.box<!fir.array<*:i32>>) -> !fir.box<!fir.array<*:i32>, volatile>
 ! CHECK:           %[[DECLARE_0:.*]]:2 = hlfir.declare %[[VOLATILE_CAST_0]] dummy_scope %[[DUMMY_SCOPE_0]] arg 1 {fortran_attrs = #fir.var_attrs<volatile>, uniq_name = "_QFFsub_select_rankEarr"} : (!fir.box<!fir.array<*:i32>, volatile>, !fir.dscope) -> (!fir.box<!fir.array<*:i32>, volatile>, !fir.box<!fir.array<*:i32>, volatile>)

``````````

</details>


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


More information about the flang-commits mailing list