This is an archive of the discontinued LLVM Phabricator instance.

[Attributor] Towards a more structured deduction pattern
ClosedPublic

Authored by jdoerfert on Aug 12 2019, 10:07 PM.

Details

Summary

This is the first commit aiming to structure the attribute deduction.
The base idea is that we have default propagation patterns as listed
below on top of which we can add specific, e.g., context sensitive,
logic.

Deduction patterns used in this patch:

  • argument states are determined from call site argument states, see AAAlignArgument and AAArgumentFromCallSiteArguments.
  • call site argument states are determined as if they were floating values, see AAAlignCallSiteArgument and AAAlignFloating.
  • floating value states are determined by traversing the def-use chain and combining the states determined for the leaves, see AAAlignFloating and genericValueTraversal.
  • call site return states are determined from function return states, see AAAlignCallSiteReturned and AACallSiteReturnedFromReturned.
  • function return states are determined from returned value states, see AAAlignReturned and AAReturnedFromReturnedValues.

Through this strategy all logic for alignment is concentrated in the
AAAlignFloating::updateImpl method.

Note: This commit works on its own but is part of a larger change that
involves "on-demand" creation of abstract attributes that will
participate in the fixpoint iteration. Without this part, we sometimes
do not have an AAAlign abstract attribute to query, loosing information
we determined before. All tests have appropriate FIXMEs and the
information will be recovered once we added all parts.

Diff Detail

Repository
rL LLVM

Event Timeline

jdoerfert created this revision.Aug 12 2019, 10:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 12 2019, 10:07 PM

Basically, I like the idea.

You have ported nonnull and align using this pattern. I want to make other attributes(willreturn, dereferenceable, nofree) deduction use this pattern. Should I wait for this patch being developed more?

llvm/lib/Transforms/IPO/Attributor.cpp
466 ↗(On Diff #214757)

Where ^= and &= are defined? Are these operators already defined?

2127 ↗(On Diff #214757)

Why is this condition necessary?

jdoerfert marked 2 inline comments as done.Aug 13 2019, 9:13 AM

Basically, I like the idea.

You have ported nonnull and align using this pattern. I want to make other attributes(willreturn, dereferenceable, nofree) deduction use this pattern. Should I wait for this patch being developed more?

We do not need to port all attributes at once even if we move to the "on-demand" creation of attributes (I'll put the patch up today).
I wanted to show how it will look like, that it will be "cleaner" and that we get better results afterwards, I mean after on-demand creation.

llvm/lib/Transforms/IPO/Attributor.cpp
466 ↗(On Diff #214757)

Sry, forgot that one. In D66146.

2127 ↗(On Diff #214757)

It is not. I will remove it.

uenoku accepted this revision.Aug 15 2019, 6:31 AM

LGTM

llvm/lib/Transforms/IPO/Attributor.cpp
562 ↗(On Diff #214757)

LLVM_DEBUG

This revision is now accepted and ready to land.Aug 15 2019, 6:31 AM
This revision was automatically updated to reflect the committed changes.