This is an archive of the discontinued LLVM Phabricator instance.

[Attributor] Use Alias Analysis in noalias callsite argument deduction
ClosedPublic

Authored by uenoku on Sep 15 2019, 11:00 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

uenoku created this revision.Sep 15 2019, 11:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2019, 11:00 PM

I like this, two comments though.

llvm/lib/Transforms/IPO/Attributor.cpp
1766 ↗(On Diff #220275)

Hoist this as far out as possible.

llvm/test/Transforms/FunctionAttrs/noalias_returned.ll
266 ↗(On Diff #220275)

Why didn't this get resolved?

uenoku added inline comments.Sep 16 2019, 5:52 AM
llvm/test/Transforms/FunctionAttrs/noalias_returned.ll
266 ↗(On Diff #220275)

This is because, for now, we check noalias for the floating value firsthand:

// (i) Check whether noalias holds in the definition.

    auto &NoAliasAA = A.getAAFor<AANoAlias>(*this, IRP);

    if (!NoAliasAA.isAssumedNoAlias())
      return indicatePessimisticFixpoint();

And GEP is not looked in AANoaliasFloaitingValue so A_0 and B_0 can't be deduced in this point.
I think it is too conservative but without this, at least global variable might be deduced as noalias in the current implementation.

jdoerfert accepted this revision.Sep 16 2019, 1:34 PM

Can you hoist the AAR definition and then this LGTM.

llvm/test/Transforms/FunctionAttrs/noalias_returned.ll
266 ↗(On Diff #220275)

I see. We need to strip the pointer in the float AANoAlias deduction later.

This revision is now accepted and ready to land.Sep 16 2019, 1:34 PM
This revision was automatically updated to reflect the committed changes.