This is an archive of the discontinued LLVM Phabricator instance.

[Attributor] Really use the executed-context
ClosedPublic

Authored by jdoerfert on Oct 30 2019, 3:29 PM.

Details

Summary
Before we did not follow casts and geps when we looked at the users of a
pointer in the pointers must-be-executed-context. This caused us to fail
to determine if it was accessed for sure. With this change we follow
such users now.

The above extension exposed problems in getKnownNonNullAndDerefBytesForUse
which did not always check what the base pointer was. We also did not
handle negative offsets as conservative as we have to without explicit
loop handling. Finally, we should not derive a huge number if we access
a pointer that was traversed backwards first.

The problems exposed by this functional change are already tested in the
existing test cases as is the functional change.

Diff Detail

Event Timeline

jdoerfert created this revision.Oct 30 2019, 3:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 30 2019, 3:30 PM

I'll reupload later with full context (sorry)

jdoerfert updated this revision to Diff 227196.Oct 30 2019, 3:49 PM
jdoerfert edited the summary of this revision. (Show Details)

Upload with full context and additional test

jdoerfert marked an inline comment as done.Oct 30 2019, 3:51 PM
jdoerfert added inline comments.
llvm/test/Transforms/InferFunctionAttrs/dereferenceable.ll
1 ↗(On Diff #227196)

leftover, will be removed.

Thanks for looking into this!
I'm not really familiar with internals of Attributor so i'll leave the review to @uenoku / @sstefan1.

uenoku accepted this revision.Oct 31 2019, 5:11 AM

LGTM

llvm/lib/Transforms/IPO/Attributor.cpp
1673–1678

It might be better to insert early returns to these blocks

This revision is now accepted and ready to land.Oct 31 2019, 5:11 AM
This revision was automatically updated to reflect the committed changes.