[PATCH] D87510: [SystemZ] Don't emit PC-relative memory accesses to unaligned (packed) symbols.

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 07:02:49 PDT 2020


jonpa added inline comments.


================
Comment at: llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp:1472
+
+  if (!SystemZISD::isPCREL(BasePtr.getOpcode()) ||
+      !MemAccess->getOffset().isUndef()) // potential index register
----------------
uweigand wrote:
> I don't think we need to check PCREL here, that should already be handled by the pattern (and has nothing to do with alignment, really).
I see it as needed because TableGen emits the code in SystemZGenDAGISel.inc in such a way that storeLoadIsAligned() is called before selectPCRelAddress(). That means that a lot of different addresses other than PCREL will show up, which needs to be filtered away.



================
Comment at: llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp:1476
+
+  // An access to GOT or constant pool is always aligned.
+  if (const PseudoSourceValue *PSV =
----------------
uweigand wrote:
> Well, there could still be an unaligned offset.  I think this check needs to be done after the offset check.
It seems that a load from CP is not a GlobalAddress, but there should still the possibility of an immediate offset reflected in the MMO. I added a check for this.

It seems safest to check both these offsets independently when they are present.



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

https://reviews.llvm.org/D87510



More information about the llvm-commits mailing list