Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ static bool runOnFunction(Function &F, bool PostInlining) {
if (F.hasFnAttribute(Attribute::Naked))
return false;

// available_externally functions may not have definitions external to the
// module (e.g. gnu::always_inline). Instrumenting them might lead to linker
// errors if they are optimized out. Skip them like GCC.
if (F.hasAvailableExternallyLinkage())
return false;

StringRef EntryAttr = PostInlining ? "instrument-function-entry-inlined"
: "instrument-function-entry";

Expand Down
7 changes: 7 additions & 0 deletions llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ define void @naked() naked {
ret void
}

define available_externally void @always_inline() {
; CHECK-LABEL: define available_externally void @always_inline() {
; CHECK-NEXT: ret void
;
ret void
}

; The attributes are "consumed" when the instrumentation is inserted.
; CHECK: attributes
; CHECK-NOT: instrument-function
Expand Down
Loading