llvm-project/flang/test/Lower/OpenMP/parallel-reduction-rename.f90
Eugene Epshteyn 413e71b700
[flang] Main program symbol no longer conflicts with the other symbols (#149169)
The following code is now accepted:
```
module m
end
program m
use m
end
```
The PROGRAM name doesn't really have an effect on the compilation
result, so it shouldn't result in symbol name conflicts.

This change makes the main program symbol name all uppercase in the
cooked character stream. This makes it distinct from all other symbol
names that are all lowercase in cooked character stream.

Modified the tests that were checking for lower case main program name.
2025-07-17 14:18:21 -04:00

37 lines
1.4 KiB
Fortran

! RUN: bbc -emit-hlfir -fopenmp -o - %s | FileCheck %s
! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s | FileCheck %s
module m1
intrinsic max
end module m1
program main
use m1, ren=>max
n=0
!$omp parallel reduction(ren:n)
print *, "par"
!$omp end parallel
end program main
! test that we understood that this should be a max reduction
! CHECK-LABEL: omp.declare_reduction @max_i32 : i32 init {
! CHECK: ^bb0(%[[VAL_0:.*]]: i32):
! CHECK: %[[VAL_1:.*]] = arith.constant -2147483648 : i32
! CHECK: omp.yield(%[[VAL_1]] : i32)
! CHECK-LABEL: } combiner {
! CHECK: ^bb0(%[[VAL_0:.*]]: i32, %[[VAL_1:.*]]: i32):
! CHECK: %[[VAL_2:.*]] = arith.maxsi %[[VAL_0]], %[[VAL_1]] : i32
! CHECK: omp.yield(%[[VAL_2]] : i32)
! CHECK: }
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "MAIN"} {
! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "n", uniq_name = "_QFEn"}
! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFEn"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: %[[VAL_2:.*]] = arith.constant 0 : i32
! CHECK: hlfir.assign %[[VAL_2]] to %[[VAL_1]]#0 : i32, !fir.ref<i32>
! CHECK: omp.parallel reduction(@max_i32 %[[VAL_1]]#0 -> %[[VAL_3:.*]] : !fir.ref<i32>) {
! ...
! CHECK: omp.terminator