llvm-project/llvm/test/Transforms/Inline/delete-unused-function.ll
Arthur Eubanks 9a0fe1b0fc [Inline] Attempt to delete any discardable if unused functions
Previously we limited ourselves to only internal/private functions. We
can also delete linkonce_odr functions.

Minor compile time wins:
https://llvm-compile-time-tracker.com/compare.php?from=d51e3474e060cb0e90dc2e2487f778b0d3e6a8de&to=bccffe3f8d5dd4dda884c9ac1f93e51772519cad&stat=instructions

Major memory wins on tramp3d:
https://llvm-compile-time-tracker.com/compare.php?from=d51e3474e060cb0e90dc2e2487f778b0d3e6a8de&to=bccffe3f8d5dd4dda884c9ac1f93e51772519cad&stat=max-rss

Relanding with fix for compile times D117236.

Reviewed By: nikic, mtrofin

Differential Revision: https://reviews.llvm.org/D115545
2022-01-13 14:48:38 -08:00

64 lines
1006 B
LLVM

; RUN: opt -passes=inline < %s -S | FileCheck %s
; CHECK: define {{.*}}@caller
; CHECK: define {{.*}}@f1
; CHECK-NOT: define {{.*}}@f2
; CHECK-NOT: define {{.*}}@f3
; CHECK-NOT: define {{.*}}@f4
; CHECK-NOT: define {{.*}}@f5
; CHECK: define {{.*}}@f6
; CHECK-NOT: define {{.*}}@f7
; CHECK-NOT: define {{.*}}@f8
$c1 = comdat any
$c2 = comdat any
$c3 = comdat any
define void @caller() {
call void @f1()
call void @f2()
call void @f3()
call void @f4()
call void @f5()
call void @f6()
call void @f7()
call void @f8()
ret void
}
define void @f1() {
ret void
}
define internal void @f2() {
ret void
}
define private void @f3() {
ret void
}
define linkonce_odr void @f4() {
ret void
}
define linkonce_odr void @f5() comdat($c1) {
ret void
}
define linkonce_odr void @f6() comdat($c2) {
ret void
}
define linkonce_odr void @g() comdat($c2) {
ret void
}
define linkonce_odr void @f7() comdat($c3) {
ret void
}
define linkonce_odr void @f8() comdat($c3) {
ret void
}