[Attributor][FIX] Do treat byval arguments special
authorJohannes Doerfert <johannes@jdoerfert.de>
Thu, 12 Dec 2019 21:02:36 +0000 (15:02 -0600)
committerJohannes Doerfert <johannes@jdoerfert.de>
Thu, 12 Dec 2019 22:04:21 +0000 (16:04 -0600)
commit6abd01e4624a2c9f8f76e11cc5d57cc7551b5d2a
tree3f46f88f1f2d2f89a8b25e053109b2216262a482
parent7081c922416b7b2348a1b10cd1d9528f3089f5fb
[Attributor][FIX] Do treat byval arguments special

When we reason about the pointer argument that is byval we actually
reason about a local copy of the value passed at the call site. This was
not the case before and we wrongly introduced attributes based on the
surrounding function.

AAMemoryBehaviorArgument, AAMemoryBehaviorCallSiteArgument and
AANoCaptureCallSiteArgument are made aware of byval now. The code
to skip "subsuming positions" for reasoning follows a common pattern and
we should refactor it. A TODO was added.

Discovered by @efriedma as part of D69748.
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/test/Transforms/Attributor/readattrs.ll