This is an archive of the discontinued LLVM Phabricator instance.

Preserve load alignment and dereferenceable metadata during some transformations
ClosedPublic

Authored by apilipenko on Oct 21 2015, 12:06 PM.

Details

Summary

Preserve new !align, !dereferenceable, !dereferenceable_or_null load metadata everywhere we preserve !nonnull metadata.

Diff Detail

Repository
rL LLVM

Event Timeline

apilipenko retitled this revision from to Preserve load alignment and dereferenceable metadata during some transformations .
apilipenko updated this object.
apilipenko added reviewers: hfinkel, reames.
apilipenko added a subscriber: llvm-commits.
reames edited edge metadata.Oct 21 2015, 6:57 PM

Test cases? Ideally, these would be split into separate patches. Given the size, I won't insist.

apilipenko updated this revision to Diff 38186.Oct 22 2015, 4:09 PM
apilipenko edited edge metadata.

Added tests, implemented correct combining of dereferenceable metadata.

hfinkel added inline comments.Oct 27 2015, 1:25 PM
lib/IR/Metadata.cpp
967 ↗(On Diff #38186)

It seems silly to copy-and-paste the same function twice with a different name. How about just naming it getMostGenericAlignmentOrDereferenceable?

apilipenko updated this revision to Diff 38607.Oct 27 2015, 4:47 PM

Address Hal's comment.

hfinkel accepted this revision.Oct 27 2015, 5:01 PM
hfinkel edited edge metadata.

One comment below, otherwise, this LGTM.

lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
376 ↗(On Diff #38607)

Move these up to combine with nonnull handling.

This revision is now accepted and ready to land.Oct 27 2015, 5:01 PM
This revision was automatically updated to reflect the committed changes.
apilipenko added inline comments.Nov 2 2015, 10:44 AM
lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
376 ↗(On Diff #38607)

nonnull code also contains logic for the case when new type is an integer. These can be combined using fall through case, but I don't think that it helps readability.