[llvm-dev] always inliner only works when function is called from external function?

Andrew Kelley via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 11 00:27:10 PDT 2017


Observe:

[nix-shell:~/tmp]$ cat test.ll
define internal fastcc void @foo() {
Entry:
  call fastcc void @bar()
  ret void
}

; Function Attrs: alwaysinline
define internal fastcc void @bar() #0 {
Entry:
  ret void
}

attributes #0 = { alwaysinline }


[nix-shell:~/tmp]$ opt test.ll -always-inline -S
; ModuleID = 'test.ll'
source_filename = "test.ll"

define internal fastcc void @foo() {
Entry:
  call fastcc void @bar()
  ret void
}

; Function Attrs: alwaysinline
define internal fastcc void @bar() #0 {
Entry:
  ret void
}

attributes #0 = { alwaysinline }


If I delete "internal" from foo, then the optimziation pass in fact inlines
bar. Is this intentional? Is there a way to make the always inliner pass
work on internal functions like this too?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170411/408f3782/attachment.html>


More information about the llvm-dev mailing list