[PATCH] D80222: Replace Clang's createRuntimeFunction with the definitions in OMPKinds.def

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 28 10:23:44 PDT 2020


jdoerfert added a comment.

This passes all the tests? I think we should go with it and investigate the cast thing later.



================
Comment at: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:124
+      return {FnTy, Fn};
+    }
   }
----------------
Are you sure we need to do the cast here? I thought clang will create it when it creates calls based of FunctionCallee objects. That was, to my understanding, the idea of the FunctionCallee thing. We might be able to just return {FnTy, Fn} here. If not we could always cast and return, as you noted a function *. Internally, only the expected type makes any sense, everything else will not be handled gracefully.


================
Comment at: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:131
+  FunctionCallee RTLFn = getOrCreateRuntimeFunction(M, FnID);
+  auto *Fn = dyn_cast<llvm::Function>(RTLFn.getCallee());
   assert(Fn && "Failed to create OpenMP runtime function");
----------------
here we probably want to cast the result if we don't do it above. Just do the `getBitCast`, it should be a no-op if there is nothing to cast.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80222





More information about the llvm-commits mailing list