Page MenuHomePhabricator

[InlineFunction] Update metadata on loads that are return values
AcceptedPublic

Authored by anna on Wed, Mar 25, 11:30 AM.

Details

Summary

This patch builds upon D76140 by updating metadata on pointer typed loads in inlined functions, when the load is the return value, and the callsite contains return attributes which can be updated as metadata on the load.
Added test cases show this for nonnull, dereferenceable, dereferenceable_or_null

Diff Detail

Event Timeline

anna created this revision.Wed, Mar 25, 11:30 AM
jdoerfert added inline comments.Wed, Mar 25, 10:34 PM
llvm/lib/Transforms/Utils/InlineFunction.cpp
1163–1164

Isn't this just VMap.lookup(V)?

1188

Num

llvm/test/Transforms/Inline/ret_load_metadata.ll
70

Is there a test where the attribute is part of the callee and not the calls site?

anna marked 2 inline comments as done.Thu, Mar 26, 6:15 AM
anna added inline comments.
llvm/lib/Transforms/Utils/InlineFunction.cpp
1163–1164

you're right. We don't need a lambda for this.

llvm/test/Transforms/Inline/ret_load_metadata.ll
70

Will add one.

anna updated this revision to Diff 252969.Thu, Mar 26, 1:39 PM

addressed review comments

jdoerfert accepted this revision.Sat, Mar 28, 12:14 AM

Minor comments, otherwise LGTM.

llvm/lib/Transforms/Utils/InlineFunction.cpp
1181

Nit: Cheap condition first: UpdateXXX && isa<...>

1226

if (auto *CB = dyn_cast<CallBase>(...))
should be simpler.

1236

Nit: I really hope that'll change, for non-null at least. Though, then we might also want to allow it in the metadata so all will be fine except the comment ;)

This revision is now accepted and ready to land.Sat, Mar 28, 12:14 AM