[flang-commits] [flang] 05a948e - [flang] Rename variables in test. NFCI

Diana Picus via flang-commits flang-commits at lists.llvm.org
Tue Jul 26 00:33:34 PDT 2022


Author: Diana Picus
Date: 2022-07-26T07:33:24Z
New Revision: 05a948e67dbb3a6c6e294a36a9015d3565c59fdb

URL: https://github.com/llvm/llvm-project/commit/05a948e67dbb3a6c6e294a36a9015d3565c59fdb
DIFF: https://github.com/llvm/llvm-project/commit/05a948e67dbb3a6c6e294a36a9015d3565c59fdb.diff

LOG: [flang] Rename variables in test. NFCI

Use pertinent names instead of numbered values, to make it easier to
update the test in future patches.

Differential Revision: https://reviews.llvm.org/D130474

Added: 
    

Modified: 
    flang/test/Lower/Intrinsics/get_command_argument-optional.f90

Removed: 
    


################################################################################
diff  --git a/flang/test/Lower/Intrinsics/get_command_argument-optional.f90 b/flang/test/Lower/Intrinsics/get_command_argument-optional.f90
index bab0e6c98ddff..bd707f1f13f75 100644
--- a/flang/test/Lower/Intrinsics/get_command_argument-optional.f90
+++ b/flang/test/Lower/Intrinsics/get_command_argument-optional.f90
@@ -2,42 +2,42 @@
 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
 
 ! CHECK-LABEL: func @_QPtest(
-! CHECK-SAME:  %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "number", fir.optional},
-! CHECK-SAME:  %[[VAL_1:.*]]: !fir.boxchar<1> {fir.bindc_name = "value", fir.optional},
-! CHECK-SAME:  %[[VAL_2:.*]]: !fir.ref<i32> {fir.bindc_name = "length", fir.optional},
-! CHECK-SAME:  %[[VAL_3:.*]]: !fir.ref<i32> {fir.bindc_name = "status", fir.optional},
-! CHECK-SAME:  %[[VAL_4:.*]]: !fir.boxchar<1> {fir.bindc_name = "errmsg", fir.optional}) {
+! CHECK-SAME:  %[[numberParam:.*]]: !fir.ref<i32> {fir.bindc_name = "number", fir.optional},
+! CHECK-SAME:  %[[valueParam:.*]]: !fir.boxchar<1> {fir.bindc_name = "value", fir.optional},
+! CHECK-SAME:  %[[lengthParam:.*]]: !fir.ref<i32> {fir.bindc_name = "length", fir.optional},
+! CHECK-SAME:  %[[statusParam:.*]]: !fir.ref<i32> {fir.bindc_name = "status", fir.optional},
+! CHECK-SAME:  %[[errmsgParam:.*]]: !fir.boxchar<1> {fir.bindc_name = "errmsg", fir.optional}) {
 subroutine test(number, value, length, status, errmsg) 
   integer, optional :: number, status, length
   character(*), optional :: value, errmsg
   ! Note: number cannot be absent
   call get_command_argument(number, value, length, status, errmsg) 
-! CHECK:  %[[VAL_5:.*]]:2 = fir.unboxchar %[[VAL_4]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
-! CHECK:  %[[VAL_6:.*]]:2 = fir.unboxchar %[[VAL_1]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
-! CHECK:  %[[VAL_7:.*]] = fir.load %[[VAL_0]] : !fir.ref<i32>
-! CHECK:  %[[VAL_8:.*]] = fir.is_present %[[VAL_6]]#0 : (!fir.ref<!fir.char<1,?>>) -> i1
-! CHECK:  %[[VAL_9:.*]] = fir.embox %[[VAL_6]]#0 typeparams %[[VAL_6]]#1 : (!fir.ref<!fir.char<1,?>>, index) -> !fir.box<!fir.char<1,?>>
-! CHECK:  %[[VAL_10:.*]] = fir.absent !fir.box<!fir.char<1,?>>
-! CHECK:  %[[VAL_11:.*]] = arith.select %[[VAL_8]], %[[VAL_9]], %[[VAL_10]] : !fir.box<!fir.char<1,?>>
-! CHECK:  %[[VAL_12:.*]] = fir.is_present %[[VAL_5]]#0 : (!fir.ref<!fir.char<1,?>>) -> i1
-! CHECK:  %[[VAL_13:.*]] = fir.embox %[[VAL_5]]#0 typeparams %[[VAL_5]]#1 : (!fir.ref<!fir.char<1,?>>, index) -> !fir.box<!fir.char<1,?>>
-! CHECK:  %[[VAL_14:.*]] = fir.absent !fir.box<!fir.char<1,?>>
-! CHECK:  %[[VAL_15:.*]] = arith.select %[[VAL_12]], %[[VAL_13]], %[[VAL_14]] : !fir.box<!fir.char<1,?>>
-! CHECK:  %[[VAL_16:.*]] = fir.convert %[[VAL_11]] : (!fir.box<!fir.char<1,?>>) -> !fir.box<none>
-! CHECK:  %[[VAL_17:.*]] = fir.convert %[[VAL_15]] : (!fir.box<!fir.char<1,?>>) -> !fir.box<none>
-! CHECK:  %[[VAL_18:.*]] = fir.call @_FortranAArgumentValue(%[[VAL_7]], %[[VAL_16]], %[[VAL_17]]) : (i32, !fir.box<none>, !fir.box<none>) -> i32
-! CHECK:  %[[VAL_19:.*]] = fir.convert %[[VAL_3]] : (!fir.ref<i32>) -> i64
-! CHECK:  %[[VAL_20:.*]] = arith.constant 0 : i64
-! CHECK:  %[[VAL_21:.*]] = arith.cmpi ne, %[[VAL_19]], %[[VAL_20]] : i64
-! CHECK:  fir.if %[[VAL_21]] {
-! CHECK:    fir.store %[[VAL_18]] to %[[VAL_3]] : !fir.ref<i32>
+! CHECK:  %[[errmsgUnboxed:.*]]:2 = fir.unboxchar %[[errmsgParam]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
+! CHECK:  %[[valueUnboxed:.*]]:2 = fir.unboxchar %[[valueParam]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
+! CHECK:  %[[number:.*]] = fir.load %[[numberParam]] : !fir.ref<i32>
+! CHECK:  %[[valueIsPresent:.*]] = fir.is_present %[[valueUnboxed]]#0 : (!fir.ref<!fir.char<1,?>>) -> i1
+! CHECK:  %[[valueReboxed:.*]] = fir.embox %[[valueUnboxed]]#0 typeparams %[[valueUnboxed]]#1 : (!fir.ref<!fir.char<1,?>>, index) -> !fir.box<!fir.char<1,?>>
+! CHECK:  %[[valueAbsent:.*]] = fir.absent !fir.box<!fir.char<1,?>>
+! CHECK:  %[[valueOrAbsent:.*]] = arith.select %[[valueIsPresent]], %[[valueReboxed]], %[[valueAbsent]] : !fir.box<!fir.char<1,?>>
+! CHECK:  %[[errmsgIsPresent:.*]] = fir.is_present %[[errmsgUnboxed]]#0 : (!fir.ref<!fir.char<1,?>>) -> i1
+! CHECK:  %[[errmsgReboxed:.*]] = fir.embox %[[errmsgUnboxed]]#0 typeparams %[[errmsgUnboxed]]#1 : (!fir.ref<!fir.char<1,?>>, index) -> !fir.box<!fir.char<1,?>>
+! CHECK:  %[[errmsgAbsent:.*]] = fir.absent !fir.box<!fir.char<1,?>>
+! CHECK:  %[[errmsgOrAbsent:.*]] = arith.select %[[errmsgIsPresent]], %[[errmsgReboxed]], %[[errmsgAbsent]] : !fir.box<!fir.char<1,?>>
+! CHECK:  %[[value:.*]] = fir.convert %[[valueOrAbsent]] : (!fir.box<!fir.char<1,?>>) -> !fir.box<none>
+! CHECK:  %[[errmsg:.*]] = fir.convert %[[errmsgOrAbsent]] : (!fir.box<!fir.char<1,?>>) -> !fir.box<none>
+! CHECK:  %[[status:.*]] = fir.call @_FortranAArgumentValue(%[[number]], %[[value]], %[[errmsg]]) : (i32, !fir.box<none>, !fir.box<none>) -> i32
+! CHECK:  %[[statusI64:.*]] = fir.convert %[[statusParam]] : (!fir.ref<i32>) -> i64
+! CHECK:  %[[zero:.*]] = arith.constant 0 : i64
+! CHECK:  %[[statusIsNonNull:.*]] = arith.cmpi ne, %[[statusI64]], %[[zero]] : i64
+! CHECK:  fir.if %[[statusIsNonNull]] {
+! CHECK:    fir.store %[[status]] to %[[statusParam]] : !fir.ref<i32>
 ! CHECK:  }
-! CHECK:  %[[VAL_22:.*]] = fir.convert %[[VAL_2]] : (!fir.ref<i32>) -> i64
-! CHECK:  %[[VAL_23:.*]] = arith.constant 0 : i64
-! CHECK:  %[[VAL_24:.*]] = arith.cmpi ne, %[[VAL_22]], %[[VAL_23]] : i64
-! CHECK:  fir.if %[[VAL_24]] {
-! CHECK:    %[[VAL_25:.*]] = fir.call @_FortranAArgumentLength(%[[VAL_7]]) : (i32) -> i64
-! CHECK:    %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i64) -> i32
-! CHECK:    fir.store %[[VAL_26]] to %[[VAL_2]] : !fir.ref<i32>
+! CHECK:  %[[lengthI64:.*]] = fir.convert %[[lengthParam]] : (!fir.ref<i32>) -> i64
+! CHECK:  %[[zero2:.*]] = arith.constant 0 : i64
+! CHECK:  %[[lengthIsNonNull:.*]] = arith.cmpi ne, %[[lengthI64]], %[[zero2]] : i64
+! CHECK:  fir.if %[[lengthIsNonNull]] {
+! CHECK:    %[[length:.*]] = fir.call @_FortranAArgumentLength(%[[number]]) : (i32) -> i64
+! CHECK:    %[[lengthTrunc:.*]] = fir.convert %[[length]] : (i64) -> i32
+! CHECK:    fir.store %[[lengthTrunc]] to %[[lengthParam]] : !fir.ref<i32>
 ! CHECK:  }
 end subroutine


        


More information about the flang-commits mailing list