Skip to content

Instantly share code, notes, and snippets.

@nikic
Created Jan 7, 2022
Embed
What would you like to do?
; RUN: opt -S -passes='cgscc(inline,instcombine)' < %s | FileCheck %s
; We use call to a dummy function to avoid inlining test1 into test2 or vice
; versa, such that we aren't left with a trivial cycle, as trivial cycles are
; special-cased to never be inlined.
; However, InstCombine will eliminate these calls after inlining, and thus
; make the functions eligible for inlining in their callers.
declare void @dummy() readnone nounwind willreturn
define void @test1() {
call void @test2()
call void @test2()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
ret void
}
define void @test2() {
call void @test1()
call void @test1()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
call void @dummy()
ret void
}
define void @test3() {
call void @test2()
call void @test2()
ret void
}
define void @test4() {
call void @test3()
call void @test3()
ret void
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment