Open thetheodor opened 3 years ago
In this case, the inliner pass fails to inline the function g after unswitch because of the cost as below debug message.
NOT Inlining (cost=250, threshold=250), Call: call void @g(i32 %2) #3
Originally, after inlining function g, the JumpThreading pass made the block with call @foo dead and SimplifyCFG pass deleted it.
If you add
always_inline
attribute to the function g's prototype as below, you can see the callfoo is gone.void g(int h) attribute((always_inline));
Do we have to adjust the inline threshold?
I think it is not good to adjust the cost function in SimpleLoopUnswitch because it calculates the cost for duplicating the target loop rather than whole function.
In this case, the inliner pass fails to inline the function g after unswitch because of the cost as below debug message.
NOT Inlining (cost=250, threshold=250), Call: call void @g(i32 %2) #3
Originally, after inlining function g, the JumpThreading pass made the block with call @foo dead and SimplifyCFG pass deleted it.
If you add always_inline
attribute to the function g's prototype as below, you can see the callfoo is gone.
void g(int h) attribute((always_inline));
Review discussion Is here: https://reviews.llvm.org/D99354
It is related to llvm/llvm-bugzilla-archive#51141
Review discussion Is here: https://reviews.llvm.org/D99354
Extended Description
The commit which introduced this regression is f3a27511c9f8