This is an archive of the discontinued LLVM Phabricator instance.

InstCombine: propagate nonNull through assume
ClosedPublic

Authored by artagnon on Jan 21 2015, 1:16 PM.

Details

Summary

Make assume (load (call|invoke) != null) set nonNull return attribute
for the call and invoke. Also include tests.

Diff Detail

Repository
rL LLVM

Event Timeline

artagnon updated this revision to Diff 18549.Jan 21 2015, 1:16 PM
artagnon retitled this revision from to InstCombine: propagate deref and nonNull return attributes.
artagnon updated this object.
artagnon edited the test plan for this revision. (Show Details)
artagnon added reviewers: reames, dexonsmith.
artagnon added a subscriber: Unknown Object (MLST).

ping! (How) should I write a test for this?

hfinkel added a subscriber: hfinkel.Feb 6 2015, 2:48 PM

ping! (How) should I write a test for this?

I think you'd add tests for the nonnull attribute in a similar way to how we test for the nonnull metadata in test/Transforms/InstCombine/assume.ll.

lib/Transforms/InstCombine/InstCombineCalls.cpp
1137 ↗(On Diff #18549)

This does not seem right. dereferenceable needs a size.

artagnon retitled this revision from InstCombine: propagate deref and nonNull return attributes to InstCombine: propagate nonNull through assume.Feb 8 2015, 4:25 PM
artagnon updated this object.
artagnon edited the test plan for this revision. (Show Details)
artagnon added a reviewer: hfinkel.
artagnon updated this revision to Diff 19561.Feb 8 2015, 4:26 PM

Drop the deref propagation, because it requires more work. Redo the
nonNull propagation so that it is correct (thanks to Hal for poking me
to test it properly).

hfinkel accepted this revision.Feb 8 2015, 4:40 PM
hfinkel edited edge metadata.

LGTM.

lib/Transforms/InstCombine/InstCombineCalls.cpp
1084 ↗(On Diff #19561)

Line too long?

This revision is now accepted and ready to land.Feb 8 2015, 4:40 PM
This revision was automatically updated to reflect the committed changes.