Skip to content

Adaptive should mark IR emitted functions with internal linkage #3501

Description

@swernli

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions