[flang-commits] [flang] [llvm] [flang][OpenMP] Track reachable metadirective replacements (PR #219014)

via flang-commits flang-commits at lists.llvm.org
Fri Sep 11 22:52:29 PDT 2026


================
@@ -2448,6 +2448,20 @@ static void AppendConstructTraitsForDirective(
     add(llvm::omp::TraitProperty::construct_dispatch_dispatch);
 }
 
+void AppendConstructTraitsForSelector(const parser::OmpTraitSelectorName &name,
+    llvm::omp::VariantMatchInfo &vmi) {
+  if (const auto *dir{std::get_if<llvm::omp::Directive>(&name.u)}) {
+    AppendConstructTraitsForDirective(*dir, vmi);
+  } else if (const auto *value{
+                 std::get_if<parser::OmpTraitSelectorName::Value>(&name.u)}) {
+    // SIMD is parsed as a predefined selector name because it can also take
+    // clause properties, unlike the other construct selectors.
+    if (*value == parser::OmpTraitSelectorName::Value::Simd) {
+      AppendConstructTraitsForDirective(llvm::omp::Directive::OMPD_simd, vmi);
----------------
MattPD wrote:

Confirmed: SIMD calls select the variant, and calls outside SIMD still select the base.

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


More information about the flang-commits mailing list