[all-commits] [llvm/llvm-project] cda579: [Inliner] Don't propagate memory attributes to byv...
Krzysztof Pszeniczny via All-commits
all-commits at lists.llvm.org
Sun May 26 09:05:35 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: cda5790e38af5da3ad455eddab36ef16bf3e8104
https://github.com/llvm/llvm-project/commit/cda5790e38af5da3ad455eddab36ef16bf3e8104
Author: Krzysztof Pszeniczny <kpszeniczny at google.com>
Date: 2024-05-26 (Sun, 26 May 2024)
Changed paths:
M llvm/lib/Transforms/Utils/InlineFunction.cpp
M llvm/test/Transforms/Inline/access-attributes-prop.ll
Log Message:
-----------
[Inliner] Don't propagate memory attributes to byval params (#93381)
Memory restrictions for params to the inlined function do not apply to
the copies logically made when that function further passes its own
params as byval.
In other words, imagine that `@foo()` calls `@bar(ptr readonly %p)`
which in turn calls `@baz(ptr byval("...") %p)` (passing the same `%p`).
This is fully legal - `baz` is allowed to modify its copy of the object
referenced by `%p` because the argument is passed by value. However,
when inlining `@bar` into `@foo`, we can't say that the callsite is now
`@baz(ptr readonly byval("...") %p)`, as this would mean that `@baz` is
not allowed to modify it's copy of the object pointed to by `%p`.
LangRef says: "The copy is considered to belong to the caller not the
callee (for example, readonly functions should not write to byval
parameters)".
This fixes a miscompile introduced by PR #89024 in a program in the
Google codebase.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list