[flang-commits] [flang] f8c8722 - [flang][openmp] Fix `not yet implemented intrinsic` message for omp_lib (#71101)

via flang-commits flang-commits at lists.llvm.org
Thu Nov 2 16:06:22 PDT 2023


Author: Razvan Lupusoru
Date: 2023-11-02T16:06:17-07:00
New Revision: f8c8722dc3c45c72db65177d62af88a2465a338c

URL: https://github.com/llvm/llvm-project/commit/f8c8722dc3c45c72db65177d62af88a2465a338c
DIFF: https://github.com/llvm/llvm-project/commit/f8c8722dc3c45c72db65177d62af88a2465a338c.diff

LOG: [flang][openmp] Fix `not yet implemented intrinsic` message for omp_lib (#71101)

PR#70386 removed hardcoded omp_lib name when checking if it is intrinsic
module procedure reference - but instead relied on bind(c) to avoid
generating error when the implementation is external to module.

However, this change only worked for HLFIR. Make it work for FIR flow
and update the test to exercise that as well.

Added: 
    

Modified: 
    flang/lib/Lower/ConvertExpr.cpp
    flang/test/Lower/OpenMP/omp-lib-num-threads.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp
index 76d810e9df6dc2d..8c2318632f725b1 100644
--- a/flang/lib/Lower/ConvertExpr.cpp
+++ b/flang/lib/Lower/ConvertExpr.cpp
@@ -2534,7 +2534,8 @@ class ScalarExprLowering {
             procRef.proc().GetSpecificIntrinsic())
       return genIntrinsicRef(procRef, resultType, *intrinsic);
 
-    if (Fortran::lower::isIntrinsicModuleProcRef(procRef))
+    if (Fortran::lower::isIntrinsicModuleProcRef(procRef) &&
+        !Fortran::semantics::IsBindCProcedure(*procRef.proc().GetSymbol()))
       return genIntrinsicRef(procRef, resultType);
 
     if (isStatementFunctionCall(procRef))

diff  --git a/flang/test/Lower/OpenMP/omp-lib-num-threads.f90 b/flang/test/Lower/OpenMP/omp-lib-num-threads.f90
index 01c3e93d97bfcc0..e1af7d375dfa5a8 100644
--- a/flang/test/Lower/OpenMP/omp-lib-num-threads.f90
+++ b/flang/test/Lower/OpenMP/omp-lib-num-threads.f90
@@ -1,5 +1,7 @@
 ! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - 2>&1 | FileCheck %s
 ! RUN: bbc -fopenmp -emit-hlfir -o - %s 2>&1 | FileCheck %s
+! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - 2>&1 | FileCheck %s
+! RUN: bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
 !
 ! Test that the calls to omp_lib's omp_get_num_threads and omp_set_num_threads
 ! get lowered even though their implementation is not in the omp_lib module


        


More information about the flang-commits mailing list