Skip to content

Commit 6fa5d28

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:6ade5183232d into amd-gfx:d5105ae3c5a9
Local branch amd-gfx d5105ae Merged main:f41ec27f7eba into amd-gfx:90bb2f06be4f Remote branch main 6ade518 [flang][openacc][NFC] Issue better error message when directive is wrong (llvm#69034)
2 parents d5105ae + 6ade518 commit 6fa5d28

File tree

11 files changed

+824
-93
lines changed

11 files changed

+824
-93
lines changed

compiler-rt/test/hwasan/TestCases/deep-recursion.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
// Stack histories are currently not recorded on x86.
1818
// XFAIL: target=x86_64{{.*}}
1919

20+
// Flaky on AArch64 Linux, see https://github.com/llvm/llvm-project/issues/69221.
21+
// UNSUPPORTED: target=aarch64-linux{{.*}}
22+
2023
#include <stdlib.h>
2124
// At least -O1 is needed for this function to not have a stack frame on
2225
// AArch64.

flang/lib/Parser/openacc-parsers.cpp

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,12 @@ TYPE_PARSER(sourced(construct<AccLoopDirective>(
150150
TYPE_PARSER(construct<AccBeginLoopDirective>(
151151
sourced(Parser<AccLoopDirective>{}), Parser<AccClauseList>{}))
152152

153-
TYPE_PARSER(construct<AccEndLoop>(startAccLine >> "END LOOP"_tok))
153+
TYPE_PARSER(construct<AccEndLoop>("END LOOP"_tok))
154154

155155
TYPE_PARSER(construct<OpenACCLoopConstruct>(
156156
sourced(Parser<AccBeginLoopDirective>{} / endAccLine),
157-
maybe(Parser<DoConstruct>{}), maybe(Parser<AccEndLoop>{} / endAccLine)))
157+
maybe(Parser<DoConstruct>{}),
158+
maybe(startAccLine >> Parser<AccEndLoop>{} / endAccLine)))
158159

159160
// 2.15.1 Routine directive
160161
TYPE_PARSER(sourced(construct<OpenACCRoutineConstruct>(verbatim("ROUTINE"_tok),
@@ -227,22 +228,25 @@ TYPE_PARSER(construct<OpenACCStandaloneConstruct>(
227228
TYPE_PARSER(construct<OpenACCStandaloneDeclarativeConstruct>(
228229
sourced(Parser<AccDeclarativeDirective>{}), Parser<AccClauseList>{}))
229230

230-
TYPE_PARSER(
231-
startAccLine >> first(sourced(construct<OpenACCDeclarativeConstruct>(
232-
Parser<OpenACCStandaloneDeclarativeConstruct>{})),
233-
sourced(construct<OpenACCDeclarativeConstruct>(
234-
Parser<OpenACCRoutineConstruct>{}))))
231+
TYPE_PARSER(startAccLine >>
232+
withMessage("expected OpenACC directive"_err_en_US,
233+
first(sourced(construct<OpenACCDeclarativeConstruct>(
234+
Parser<OpenACCStandaloneDeclarativeConstruct>{})),
235+
sourced(construct<OpenACCDeclarativeConstruct>(
236+
Parser<OpenACCRoutineConstruct>{})))))
235237

236238
// OpenACC constructs
237239
TYPE_CONTEXT_PARSER("OpenACC construct"_en_US,
238240
startAccLine >>
239-
first(construct<OpenACCConstruct>(Parser<OpenACCBlockConstruct>{}),
240-
construct<OpenACCConstruct>(Parser<OpenACCCombinedConstruct>{}),
241-
construct<OpenACCConstruct>(Parser<OpenACCLoopConstruct>{}),
242-
construct<OpenACCConstruct>(Parser<OpenACCStandaloneConstruct>{}),
243-
construct<OpenACCConstruct>(Parser<OpenACCCacheConstruct>{}),
244-
construct<OpenACCConstruct>(Parser<OpenACCWaitConstruct>{}),
245-
construct<OpenACCConstruct>(Parser<OpenACCAtomicConstruct>{})))
241+
withMessage("expected OpenACC directive"_err_en_US,
242+
first(construct<OpenACCConstruct>(Parser<OpenACCBlockConstruct>{}),
243+
construct<OpenACCConstruct>(Parser<OpenACCCombinedConstruct>{}),
244+
construct<OpenACCConstruct>(Parser<OpenACCLoopConstruct>{}),
245+
construct<OpenACCConstruct>(
246+
Parser<OpenACCStandaloneConstruct>{}),
247+
construct<OpenACCConstruct>(Parser<OpenACCCacheConstruct>{}),
248+
construct<OpenACCConstruct>(Parser<OpenACCWaitConstruct>{}),
249+
construct<OpenACCConstruct>(Parser<OpenACCAtomicConstruct>{}))))
246250

247251
TYPE_PARSER(startAccLine >>
248252
sourced(construct<AccEndCombinedDirective>(sourced("END"_tok >>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
2+
3+
!CHECK: func.func @_QPfirstprivate_common() {
4+
!CHECK: %[[val_0:.*]] = fir.address_of(@c_) : !fir.ref<!fir.array<8xi8>>
5+
!CHECK: %[[val_1:.*]] = fir.convert %[[val_0]] : (!fir.ref<!fir.array<8xi8>>) -> !fir.ref<!fir.array<?xi8>>
6+
!CHECK: %[[val_c0:.*]] = arith.constant 0 : index
7+
!CHECK: %[[val_2:.*]] = fir.coordinate_of %[[val_1]], %[[val_c0]] : (!fir.ref<!fir.array<?xi8>>, index) -> !fir.ref<i8>
8+
!CHECK: %[[val_3:.*]] = fir.convert %[[val_2]] : (!fir.ref<i8>) -> !fir.ref<f32>
9+
!CHECK: %[[VAL_3_DECL:.*]]:2 = hlfir.declare %[[val_3]] {uniq_name = "_QFfirstprivate_commonEx"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
10+
!CHECK: %[[val_4:.*]] = fir.convert %[[val_0]] : (!fir.ref<!fir.array<8xi8>>) -> !fir.ref<!fir.array<?xi8>>
11+
!CHECK: %[[val_c4:.*]] = arith.constant 4 : index
12+
!CHECK: %[[val_5:.*]] = fir.coordinate_of %[[val_4]], %[[val_c4]] : (!fir.ref<!fir.array<?xi8>>, index) -> !fir.ref<i8>
13+
!CHECK: %[[val_6:.*]] = fir.convert %[[val_5]] : (!fir.ref<i8>) -> !fir.ref<f32>
14+
!CHECK: %[[VAL_6_DECL:.*]]:2 = hlfir.declare %[[val_6]] {uniq_name = "_QFfirstprivate_commonEy"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
15+
!CHECK: omp.parallel {
16+
!CHECK: %[[val_7:.*]] = fir.alloca f32 {bindc_name = "x", pinned, uniq_name = "_QFfirstprivate_commonEx"}
17+
!CHECK: %[[VAL_7_DECL:.*]]:2 = hlfir.declare %[[val_7]] {uniq_name = "_QFfirstprivate_commonEx"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
18+
!CHECK: %[[val_8:.*]] = fir.load %[[VAL_3_DECL]]#1 : !fir.ref<f32>
19+
!CHECK: fir.store %[[val_8]] to %[[VAL_7_DECL]]#1 : !fir.ref<f32>
20+
!CHECK: %[[val_9:.*]] = fir.alloca f32 {bindc_name = "y", pinned, uniq_name = "_QFfirstprivate_commonEy"}
21+
!CHECK: %[[VAL_9_DECL:.*]]:2 = hlfir.declare %[[val_9]] {uniq_name = "_QFfirstprivate_commonEy"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
22+
!CHECK: %[[val_10:.*]] = fir.load %[[VAL_6_DECL]]#1 : !fir.ref<f32>
23+
!CHECK: fir.store %[[val_10]] to %[[VAL_9_DECL]]#1 : !fir.ref<f32>
24+
!CHECK: omp.terminator
25+
!CHECK: }
26+
!CHECK: return
27+
!CHECK: }
28+
29+
subroutine firstprivate_common
30+
common /c/ x, y
31+
real x, y
32+
!$omp parallel firstprivate(/c/)
33+
!$omp end parallel
34+
end subroutine

0 commit comments

Comments
 (0)