[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
Fri Sep 11 06:25:40 PDT 2020


jonpa created this revision.
jonpa added a reviewer: uweigand.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
jonpa requested review of this revision.

In the presence of packed structures (#pragma pack(1)) where elements are referenced through pointers, there will be stores/loads with alignment values matching the default alignments for the element types while the elements are in fact unaligned. Strictly speaking this is incorrect source code, but is unfortunately part of existing code and therefore now addressed.

This patch improves the pattern predicate for PC-relative loads and stores by not only checking the alignment value of the instruction, but also making sure that the symbol (and element) itself is aligned.

Fixes https://bugs.llvm.org/show_bug.cgi?id=44405


https://reviews.llvm.org/D87510

Files:
  llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
  llvm/lib/Target/SystemZ/SystemZOperators.td
  llvm/test/CodeGen/SystemZ/int-move-10.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87510.291194.patch
Type: text/x-patch
Size: 9515 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200911/c960f4c8/attachment.bin>


More information about the llvm-commits mailing list