This is an archive of the discontinued LLVM Phabricator instance.

[Lint] Don't warn about noalias argument aliasing if other argument is byval
ClosedPublic

Authored by uabelho on Nov 16 2017, 12:05 AM.

Details

Summary

When using byval, the data is effectively copied as part of the call
anyway, so we aren't actually passing the pointer and thus there is no
reason to issue a warning.

Diff Detail

Repository
rL LLVM

Event Timeline

uabelho created this revision.Nov 16 2017, 12:05 AM

Quite similar to D40009.

rnk added inline comments.Nov 16 2017, 10:06 AM
lib/Analysis/Lint.cpp
269 ↗(On Diff #123135)

AttributeList is a lightweight pointer wrapper that is typically passed by value. No need for const & here.

270–273 ↗(On Diff #123135)

This can be simplified to just CS.getAttributes().

275 ↗(On Diff #123135)

for (Value *OtherArg : CS.args()) { ?

uabelho updated this revision to Diff 123294.Nov 16 2017, 11:11 PM

Addressed two of three comments.

uabelho marked 2 inline comments as done.Nov 16 2017, 11:13 PM

Thanks for the comments!

lib/Analysis/Lint.cpp
275 ↗(On Diff #123135)

I could probably change it but I'm hesitant to do it since BI is also used in "AI != BI" below to skip over when "OtherArg == Arg" and I don't want to mess up anything just to do some kind of unrelated refactoring.

Ok, or do you want me to do something with the for loop anyway?

Ping. Ok to submit?

rnk accepted this revision.Dec 20 2017, 4:01 PM

lgtm

Apparently I filled this in but never hit submit.

This revision is now accepted and ready to land.Dec 20 2017, 4:01 PM
This revision was automatically updated to reflect the committed changes.
In D40118#961538, @rnk wrote:

lgtm

Apparently I filled this in but never hit submit.

Thanks! Pushed it now.