[PATCH] D81126: [PowerPC] Fix for PC Relative call protocol

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 18 10:19:22 PDT 2020


sfertile added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:4721
+
+    const Function *F = dyn_cast<Function>(GV);
+    // Without a valid function pointer we cannot check if the TOC is the same.
----------------
Could the `GlobalValue` be a `GlobalindirectSymbol` instead of a function?


================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:4924
   // Check if we share the TOC base.
   if (!Subtarget.isUsingPCRelativeCalls() &&
+      !callDoesNotRequireTOCRestore(&Caller, Callee, getTargetMachine()))
----------------
There feels like a disconnect: At one call site we only call the helper function if the subtarget is not using pc-relative calls, but at the other call site we call the helper indiscriminately and rely on logic in  the helper to check if the caller is using pc-relative calls. I think its best to keep the helper as `callsShareTOCBase` and only call it in the case the caller is not using pc-relative calls.  I am assuming that we consider a function using pc-relative calls as not maintaining the toc-pointer, and so the answer in that case is trivially `no, they do not share a toc base regardless of any other properties`.


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

https://reviews.llvm.org/D81126





More information about the llvm-commits mailing list