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

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 03:44:41 PDT 2020


stefanp marked 2 inline comments as done.
stefanp added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:4701
+  // is PC Relative since PC Relative callers do not have a TOC.
+  const PPCSubtarget *STICaller = &TM.getSubtarget<PPCSubtarget>(*Caller);
+  assert(!STICaller->isUsingPCRelativeCalls() &&
----------------
sfertile wrote:
> If this is only used in the assert then it will causes a warning to be introduced in builds where asserts are disabled.
Good catch. I'll add an `NDEBUG` around it.


================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:4748
+    // functions do not share a TOC base.
+    if (STICallee->isUsingPCRelativeCalls())
+      return false;
----------------
sfertile wrote:
> Do we only check this when targeting large/medium code model because PCRel calls is exclusive to medium code model? If the callee and caller already have different attributes, could they have differing code models as well? The case I'm thinking about would be if callee/caller are in different modules say in a lto or thin lto compile.
It's true that PC Rel is only for medium code model. However, as you mentioned, the TOC caller code can be in any model. I'll move this PCRel checking code out of the `if` statement.


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

https://reviews.llvm.org/D81126





More information about the llvm-commits mailing list