[llvm-dev] RFC: New function attribute "patchable-prologue"="<kind>"

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 6 13:11:58 PDT 2016



Mehdi Amini wrote:
 >> On Apr 6, 2016, at 12:48 PM, Sanjoy Das via 
llvm-dev<llvm-dev at lists.llvm.org>  wrote:
 >>
 >>
 >>
 >> Reid Kleckner wrote:
 >>> I'm assuming this attribute won't affect inlining or other IPO in any
 >>> way, but you should probably mention that in the langref.
 >> To directly answer this, this is just a *mechanism* to implement 
linkonce_odr type linkage.  This in itself does not imply in IPO 
restrictions, that should come directly from the linkage type.
 >
 > What do you mean "this is just a *mechanism* to implement 
linkonce_odr type linkage”?
 > linkonce_odr are allowed to be inlined, and a client that is 
interested in “hot patching” a function implementation is probably not 
expecting this?

What I mean is that "patchable-prologue" allows the client (user
of LLVM) to do "late-linking" in some sense (i.e. do what typically
the linker would have done, but at runtime).  But //what// gets linked
to is still determined by the linkage type.

So for a callee if you have (linkonce +
"patchable-patchable"="hotpatch-compact") then you cannot inline since
the runtime may want to replace the body with something totally
different.  But if you have (linkonce_odr +
"patchable-patchable"="hotpatch-compact") then you are allowed to
inline since the runtime will replace the callee with something for a
which you have *a* correct implementation.  In other words, the mid
level optimizer can ignore "patchable-patchable" for purposes of IPO,
since it does not dictate what will happen, but only *how* it will
happen at a very low level.

Did that make sense?

-- Sanjoy


More information about the llvm-dev mailing list