Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Incorrect inlining cost calculation with new pass manager #41094

Open Quuxplusone opened 5 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR42124
Status NEW
Importance P normal
Reported by Yi Kong (yikong@google.com)
Reported on 2019-06-04 13:31:30 -0700
Last modified on 2021-10-09 14:11:46 -0700
Version trunk
Hardware PC All
CC chandlerc@gmail.com, dblaikie@gmail.com, htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, ndesaulniers@google.com, srhines@google.com, yuanfang.chen@sony.com
Fixed by commit(s)
Attachments aec_port_reduced.c (598 bytes, text/plain)
Blocks
Blocked by
See also
Created attachment 22072
Reduced reproducer

aec_port_reset_output_index is a small static method and is only called once.
There should be performance gain by inlining the method:

$ clang -c -w -O2 -Rpass=inline aec_port_reduced.c
aec_port_reduced.c:46:11: remark: aec_port_reset_output_index inlined into d
with (cost=-14955, threshold=225) [-Rpass=inline]
          aec_port_reset_output_index();
          ^

However with the new pass manager:

$ clang -c -w -fexperimental-new-pass-manager -O2 -Rpass-missed=inline
aec_port_reduced.c
aec_port_reduced.c:46:11: remark: aec_port_reset_output_index not inlined into
d because too costly to inline (cost=45, threshold=45) [-Rpass-missed=inline]
          aec_port_reset_output_index();
          ^
Quuxplusone commented 5 years ago

Attached aec_port_reduced.c (598 bytes, text/plain): Reduced reproducer

Quuxplusone commented 5 years ago

https://reviews.llvm.org/D63034 was proposed to address this, but still needs some follow-up.