This is an archive of the discontinued LLVM Phabricator instance.

[Lint] Don't warn about passing alloca'd value to tail call if using byval
ClosedPublic

Authored by uabelho on Nov 14 2017, 2:11 AM.

Details

Summary

This fixes PR35241.

When using byval, the data is effectively copied as part of the call
anyway, so the pointer returned by the alloca will not be leaked to the
callee and thus there is no reason to issue a warning.

Diff Detail

Repository
rL LLVM

Event Timeline

uabelho created this revision.Nov 14 2017, 2:11 AM
Ka-Ka added a subscriber: Ka-Ka.Nov 14 2017, 2:15 AM
rnk accepted this revision.Nov 14 2017, 9:24 AM

lgtm with suggestion

lib/Analysis/Lint.cpp
293–294 ↗(On Diff #122796)

You should be able to update this to range-based for like:

for (const Value *Arg : CS.args()) {
  ...
This revision is now accepted and ready to land.Nov 14 2017, 9:24 AM
uabelho updated this revision to Diff 122968.Nov 14 2017, 11:09 PM

Updated the for loop so it's range based. (Couldn't make Arg const though since the findValue
argument isn't const.)

uabelho marked an inline comment as done.Nov 14 2017, 11:10 PM

Thanks for the review. I fixed the suggestion so I'll submit this now.

This revision was automatically updated to reflect the committed changes.