[flang-commits] [flang] [flang][acc][lowering] Declare undeclared acc routine bind(name) targets (PR #203088)

via flang-commits flang-commits at lists.llvm.org
Fri Jun 12 02:11:53 PDT 2026


================
@@ -597,6 +597,16 @@ class FirConverter : public Fortran::lower::AbstractConverter {
           u);
     }
 
+    // Declare any `acc routine` bind(name) targets not otherwise declared, so a
+    // live symbol exists for later passes. No-op for targets already lowered in
+    // this unit.
+    if (getFoldingContext().languageFeatures().IsEnabled(
+            Fortran::common::LanguageFeature::OpenACC))
+      createBuilderOutsideOfFuncOpAndDo([&]() {
+        Fortran::lower::materializeOpenACCRoutineBindTargets(
+            *this, bridge.getSemanticsContext());
+      });
----------------
jeanPerier wrote:

OK, then I think it is best to keep it the way you did it (or to move the func.func generation way later when the acc lowering actually needs the func.func to exits (i.e. emits calls to them).

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


More information about the flang-commits mailing list