This patch is part of a series which ultimately allows us to splice the last use of a callee instead of clone it. The other patches are ready but i'd like to get this done first.
This patch updates the call graph whenever the inliner devirtualizes a call based on a returned value.
That is, if we have the following, then after @f1 is inlined, the call to % funcall1_ actually points to @f2. The inliner will currently proceed with inlining @f2 but with out of date call graph information.
define i32 @test1() {
%funcall1_ = call fastcc i32 ()* ()* @f1() %executecommandptr1_ = call i32 %funcall1_() ret i32 %executecommandptr1_
}
define internal fastcc i32 ()* @f1() nounwind readnone {
ret i32 ()* @f2
}
define internal i32 @f2() nounwind readnone {
ret i32 1
}
You can just write: