This is an archive of the discontinued LLVM Phabricator instance.

[CorrelatedValuePropagation] Infer nonnull attributes
ClosedPublic

Authored by igor-laevsky on Sep 14 2015, 5:18 AM.

Details

Summary

LazuValueInfo can prove that value is nonnull based on the context information. Make use of this ability to infer nonnull attributes for the call arguments.

There is almost similar code inside InstCombine. However it uses isKnownNonNull which is less precise than LazyValueInfo.

Diff Detail

Repository
rL LLVM

Event Timeline

igor-laevsky retitled this revision from to [CorrelatedValuePropagation] Infer nonnull attributes.
igor-laevsky updated this object.
igor-laevsky added reviewers: reames, hfinkel.
igor-laevsky set the repository for this revision to rL LLVM.
igor-laevsky added a subscriber: llvm-commits.
reames accepted this revision.Sep 14 2015, 11:21 AM
reames edited edge metadata.

LGTM w/minor comments addressed.

test/Transforms/CorrelatedValuePropagation/non-null.ll
106 ↗(On Diff #34665)

Add CHECK-LABEL: @test10 please.

116 ↗(On Diff #34665)

Adding a test case which shows a merge point with two known nonnull pointers merging through a phi into a call would nicely illustrate the power of this transformation. Do you mind adding that?

This revision is now accepted and ready to land.Sep 14 2015, 11:21 AM
This revision was automatically updated to reflect the committed changes.
igor-laevsky marked 2 inline comments as done.Sep 15 2015, 10:54 AM
thakis added a subscriber: thakis.Sep 15 2015, 11:51 AM

(I updated clang tests for this in r247712)