[PATCH] D118685: [ArgPromotion] Make implementation offset based

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 1 02:17:13 PST 2022


nikic created this revision.
nikic added a reviewer: opaque-pointers.
Herald added subscribers: ormris, hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This rewrites ArgPromotion to be based on offsets rather than GEP structure. We inspect all loads at constant offsets and remember which types are loaded at which offsets. Then we promote based on those types.

This generalizes ArgPromotion to work with bitcasted loads, and is compatible with opaque pointers.

This patch also fixes incorrect handling of alignment during argument promotion. Previously, the implementation only checked that the pointer is dereferenceable, but was happy to speculate overaligned loads. (I would have fixed this separately in advance, but I found this hard to do with the previous implementation approach).

I also encountered some incorrect AA metadata transfer in the old implementation, but I'm leaving that for a separate patch, as that part can be cleanly separated.


https://reviews.llvm.org/D118685

Files:
  llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
  llvm/test/Transforms/ArgumentPromotion/align.ll
  llvm/test/Transforms/ArgumentPromotion/fp80.ll
  llvm/test/Transforms/ArgumentPromotion/opaque-ptr.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118685.404848.patch
Type: text/x-patch
Size: 44207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220201/60233c43/attachment.bin>


More information about the llvm-commits mailing list