Skip to content

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

Merged
linuxlonelyeagle merged 1 commit into
llvm:mainfrom
linuxlonelyeagle:use-check-dag-check-constant
Feb 27, 2026
Merged

linuxlonelyeagle merged 1 commit into
llvm:mainfrom
linuxlonelyeagle:use-check-dag-check-constant

Conversation

@linuxlonelyeagle

Copy link
Copy Markdown
Member

It is part of #180556, as a separate NFC PR

@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Feb 27, 2026
@linuxlonelyeagle
linuxlonelyeagle requested review from jeanPerier and luporl and removed request for jeanPerier February 27, 2026 06:03
@llvmbot

llvmbot commented Feb 27, 2026

Copy link
Copy Markdown
Member

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

Author: lonely eagle (linuxlonelyeagle)

Changes

It is part of #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 --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>)

@eugeneepshteyn eugeneepshteyn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@linuxlonelyeagle

Copy link
Copy Markdown
Member Author

@eugeneepshteyn Thank you help review the code.

@linuxlonelyeagle
linuxlonelyeagle merged commit 1a6bd39 into llvm:main Feb 27, 2026
13 checks passed
sujianIBM pushed a commit to sujianIBM/llvm-project that referenced this pull request Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flang:fir-hlfir flang Flang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants