[llvm-dev] RFC: New function attribute HasInaccessibleState
Krzysztof Parzyszek via llvm-dev
llvm-dev at lists.llvm.org
Fri Dec 4 09:35:42 PST 2015
On 12/4/2015 11:21 AM, Vaivaswatha Nagaraj wrote:
> >That's in practice impossible to guarantee, both by the compiler and
> by the programmer.
> I'm not sure I understand this. Why would it be impossible for the
> compiler to propagate this flag along the call graph upwards? As an
> example, malloc has the flag set, and this is propagated to whoever
> calls malloc, and then to whoever calls that function and so on.
Most of the time you don't have the entire call graph information.
Imagine that you are developing a module that is a part of a larger
project. Functions in the other modules would need to have their flags
updated based on what your functions do.
If you want to have an attribute stating that a function behaves better
than what the compiler would normally assume, then the callers may but
don't have to have that attribute set. If you require that attribute
for correctness, you will run into problems. The sentence "For example,
printf would have the flag set, preventing two calls to printfs (without
the return value being used) from being interchanged." and the rest of
that paragraph suggests the latter.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-dev