[PATCH] D65977: [Attributor] Use IRPosition consistently

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 14:43:17 PDT 2019


jdoerfert created this revision.
jdoerfert added reviewers: sstefan1, uenoku.
Herald added subscribers: bollu, hiraditya.
Herald added a project: LLVM.

The next attempt to clean up the Attributor interface before we grow it
further.

Before, we used a combination of two values (associated + anchor) and an
argument number (or -1) to determine a location. This was very fragile.
The new system uses exclusively IR positions and we restrict the
generation of IR positions to special constructor methods that verify
internal constraints we have. This will catch misuse early.

The auto-conversion, e.g., in getAAFor, is now performed through the
SubsumingPositionIterator. This iterator takes an IR position and allows
to visit all IR positions that "subsume" the given one, e.g., function
attributes "subsume" argument attributes of that function. For a
detailed breakdown see the class comment of SubsumingPositionIterator.

This patch also introduces the IRPosition::getAttrs() to extract IR
attributes at a certain position. The method knows how to look up in
different positions that are equivalent, e.g., the argument position for
call site arguments. We also introduce three new positions kinds such
that we have all IR positions where attributes can be placed and one for
"floating" values.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65977

Files:
  llvm/include/llvm/Transforms/IPO/Attributor.h
  llvm/lib/Transforms/IPO/Attributor.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65977.214241.patch
Type: text/x-patch
Size: 75548 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190808/b17080ea/attachment.bin>


More information about the llvm-commits mailing list