[PATCH] D34708: [NVPTX] Allow to make libcalls that are defined in the current module.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 14:03:02 PDT 2017


arsenm added a comment.

This is something I've thought about doing before. Does this work with the TLI lib call simplification as is, and this is the only required codegen part?



================
Comment at: lib/Target/NVPTX/NVPTXISelLowering.cpp:1841-1848
+  if (!CS) {
+    // Unfortunately, libcall expansion does not respect `Chain`...
+    // Our `CALLSEQ_END` becomes dead node (i.e. nobody references it) because
+    // only retval `LoadParam`s will be used after expansion. That means the
+    // node will be deleted at the next iteration of legalization and we have
+    // to make effors to keep it alive.
+    DAG.KeepNodeAlive(Chain.getNode(), true);
----------------
This is probably the wrong way to do this. You probably want to do a getMergeValues with the returned value and the entry chain


================
Comment at: lib/Target/NVPTX/NVPTXISelLowering.cpp:2313-2315
+SDValue
+NVPTXTargetLowering::LowerLibcallFnNameSymbol(SDValue Op,
+                                              SelectionDAG &DAG) const {
----------------
Can you move this to generic DAG code?


https://reviews.llvm.org/D34708





More information about the llvm-commits mailing list