File tree Expand file tree Collapse file tree 5 files changed +15
-13
lines changed Expand file tree Collapse file tree 5 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -347,7 +347,8 @@ struct Evaluation : EvaluationVariant {
347
347
parser::CharBlock position{};
348
348
std::optional<parser::Label> label{};
349
349
std::unique_ptr<EvaluationList> evaluationList; // nested evaluations
350
- llvm::SmallVector<const parser::CompilerDirective *> dirs;
350
+ // associated compiler directives
351
+ llvm::SmallVector<const parser::CompilerDirective *, 1 > dirs;
351
352
Evaluation *parentConstruct{nullptr }; // set for nodes below the top level
352
353
Evaluation *lexicalSuccessor{nullptr }; // set for leaf nodes, some directives
353
354
Evaluation *controlSuccessor{nullptr }; // set for some leaf nodes
Original file line number Diff line number Diff line change @@ -2596,18 +2596,16 @@ class FirConverter : public Fortran::lower::AbstractConverter {
2596
2596
}
2597
2597
}
2598
2598
2599
- void attachLoopDirective (const Fortran::parser::CompilerDirective &dir,
2599
+ void attachDirectiveToLoop (const Fortran::parser::CompilerDirective &dir,
2600
2600
Fortran::lower::pft::Evaluation *e) {
2601
- while (e->isDirective ()) {
2601
+ while (e->isDirective ())
2602
2602
e = e->lexicalSuccessor ;
2603
- }
2604
2603
2605
- if (e->isA <Fortran::parser::NonLabelDoStmt>()) {
2604
+ if (e->isA <Fortran::parser::NonLabelDoStmt>())
2606
2605
e->dirs .push_back (&dir);
2607
- } else {
2606
+ else
2608
2607
fir::emitFatalError (toLocation (),
2609
2608
" loop directive must appear before a loop" );
2610
- }
2611
2609
}
2612
2610
2613
2611
void genFIR (const Fortran::parser::CompilerDirective &dir) {
@@ -2616,7 +2614,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
2616
2614
std::visit (
2617
2615
Fortran::common::visitors{
2618
2616
[&](const Fortran::parser::CompilerDirective::VectorAlways &) {
2619
- attachLoopDirective (dir, &eval);
2617
+ attachDirectiveToLoop (dir, &eval);
2620
2618
},
2621
2619
[&](const auto &) {}},
2622
2620
dir.u );
Original file line number Diff line number Diff line change @@ -8886,9 +8886,12 @@ void ResolveNamesVisitor::Post(const parser::AssignedGotoStmt &x) {
8886
8886
}
8887
8887
8888
8888
void ResolveNamesVisitor::Post (const parser::CompilerDirective &x) {
8889
- if (const auto *dir{
8890
- std::get_if<parser::CompilerDirective::VectorAlways>(&x.u )})
8889
+ // if (const auto *dir{
8890
+ // std::get_if<parser::CompilerDirective::VectorAlways>(&x.u)})
8891
+
8892
+ if (std::holds_alternative<parser::CompilerDirective::VectorAlways>(x.u )) {
8891
8893
return ;
8894
+ }
8892
8895
if (const auto *tkr{
8893
8896
std::get_if<std::list<parser::CompilerDirective::IgnoreTKR>>(&x.u )}) {
8894
8897
if (currScope ().IsTopLevel () ||
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ func.func @_QPvector_always() {
19
19
%5 = fir.convert %c1_i32 : (i32) -> index
20
20
%6 = fir.convert %c10_i32 : (i32) -> index
21
21
%7 = fir.convert %5 : (index) -> i32
22
- %8:2 = fir.do_loop %arg0 = %5 to %6 step %c1 iter_args(%arg1 = %7) -> (index, i32) attributes {loop_annotation = #loop_annotation} {
22
+ %8:2 = fir.do_loop %arg0 = %5 to %6 step %c1 iter_args(%arg1 = %7) -> (index, i32) attributes {loopAnnotation = #loop_annotation} {
23
23
fir.store %arg1 to %4 : !fir.ref<i32>
24
24
%9 = fir.load %4 : !fir.ref<i32>
25
25
%10 = fir.load %4 : !fir.ref<i32>
Original file line number Diff line number Diff line change 10
10
subroutine vector_always
11
11
integer :: a(10 )
12
12
! dir$ vector always
13
- ! CHECK: fir.do_loop {{.*}} attributes {loop_annotation = #loop_annotation}
13
+ ! CHECK: fir.do_loop {{.*}} attributes {loopAnnotation = #loop_annotation}
14
14
do i= 1 ,10
15
15
a(i)= i
16
16
end do
@@ -22,7 +22,7 @@ subroutine intermediate_directive
22
22
integer :: a(10 )
23
23
! dir$ vector always
24
24
! dir$ unknown
25
- ! CHECK: fir.do_loop {{.*}} attributes {loop_annotation = #loop_annotation1}
25
+ ! CHECK: fir.do_loop {{.*}} attributes {loopAnnotation = #loop_annotation1}
26
26
do i= 1 ,10
27
27
a(i)= i
28
28
end do
You can’t perform that action at this time.
0 commit comments