[flang-commits] [PATCH] D154230: [flang][hlfir] probe ultimate intrinsic module procedure name

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jun 30 11:27:59 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG247bad1671a8: [flang][hlfir] probe ultimate intrinsic module procedure name (authored by jeanPerier).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154230/new/

https://reviews.llvm.org/D154230

Files:
  flang/lib/Lower/ConvertCall.cpp
  flang/test/Lower/HLFIR/intrinsic-module-procedures.f90


Index: flang/test/Lower/HLFIR/intrinsic-module-procedures.f90
===================================================================
--- flang/test/Lower/HLFIR/intrinsic-module-procedures.f90
+++ flang/test/Lower/HLFIR/intrinsic-module-procedures.f90
@@ -21,3 +21,14 @@
 ! CHECK:         %[[VAL_8:.*]] = fir.box_addr %[[VAL_4]] : (!fir.box<i32>) -> !fir.ref<i32>
 ! CHECK:         %[[VAL_9:.*]] = fir.convert %[[VAL_8]] : (!fir.ref<i32>) -> i64
 ! CHECK:         fir.store %[[VAL_9]] to %[[VAL_7]] : !fir.ref<i64>
+
+subroutine test_renaming(p)
+  use iso_c_binding, only: c_associated_alias => c_associated, c_ptr
+  type(c_ptr) p
+  print *, c_associated_alias(p)
+end subroutine
+
+! CHECK-LABEL: func.func @_QPtest_renaming
+! CHECK:  %[[C_PTR_TARG:.*]] = fir.load %{{.*}} : !fir.ref<i64>
+! CHECK:  %[[NULL:.*]] = arith.constant 0 : i64
+! CHECK:  arith.cmpi ne, %[[C_PTR_TARG]], %[[NULL]] : i64
Index: flang/lib/Lower/ConvertCall.cpp
===================================================================
--- flang/lib/Lower/ConvertCall.cpp
+++ flang/lib/Lower/ConvertCall.cpp
@@ -583,7 +583,11 @@
 
   fir::FirOpBuilder &getBuilder() { return converter.getFirOpBuilder(); }
 
-  std::string getProcedureName() const { return procRef.proc().GetName(); }
+  std::string getProcedureName() const {
+    if (const Fortran::semantics::Symbol *sym = procRef.proc().GetSymbol())
+      return sym->GetUltimate().name().ToString();
+    return procRef.proc().GetName();
+  }
 
   /// Is this a call to an elemental procedure with at least one array argument?
   bool isElementalProcWithArrayArgs() const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154230.536336.patch
Type: text/x-patch
Size: 1599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230630/a09ee004/attachment.bin>


More information about the flang-commits mailing list