When the compiler emits function definitions into QIR with the Adaptive profile, those functions may get inlined by later LLVM optimization passes but can't be removed as they have no explicit linkage, so LLVM treats them as external by default. If we instead mark them internal, as in:
define internal void @H(ptr %var_13) {
block_53:
call void @__quantum__qis__h__body(ptr %var_13)
ret void
}
Then later processing/passes will know they are safe to delete as part of global dead code elimination if all uses have been inlined.
When the compiler emits function definitions into QIR with the
Adaptiveprofile, those functions may get inlined by later LLVM optimization passes but can't be removed as they have no explicit linkage, so LLVM treats them asexternalby default. If we instead mark theminternal, as in:Then later processing/passes will know they are safe to delete as part of global dead code elimination if all uses have been inlined.