[flang-commits] [flang] [flang] Implement !DIR$ VECTOR ALWAYS (PR #93830)

via flang-commits flang-commits at lists.llvm.org
Tue Jun 4 07:59:27 PDT 2024


================
@@ -2508,8 +2531,30 @@ class FirConverter : public Fortran::lower::AbstractConverter {
     }
   }
 
-  void genFIR(const Fortran::parser::CompilerDirective &) {
-    // TODO
+  void attachLoopDirective(const Fortran::parser::CompilerDirective &dir,
+                           Fortran::lower::pft::Evaluation *e) {
+    while (e->isDirective()) {
+      e = e->lexicalSuccessor;
+    }
+
+    if (e->isA<Fortran::parser::NonLabelDoStmt>()) {
+      e->dirs.push_back(&dir);
+    } else {
+      fir::emitFatalError(toLocation(),
+                          "loop directive must appear before a loop");
----------------
jeanPerier wrote:

Another point is how this combined with OpenMP/OpenACC loop directives. The vector directive could be placed before an OpenMP/openACC directive (or maybe after).

Since there is no real spec for this kind of scenarios, I think we may want to allow it and still reflect the directive intent on the ACC/OpenMP loop in FIR.

https://github.com/llvm/llvm-project/pull/93830


More information about the flang-commits mailing list