Bug 71587 - missed inlining extern template function
Summary: missed inlining extern template function
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 5.3.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2016-06-20 02:03 UTC by programmerjake
Modified: 2016-06-26 06:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-06-26 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description programmerjake 2016-06-20 02:03:07 UTC
missed inlining fn2<false>

version: (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204

command: g++-5 -O3 -S -std=c++11 -xc++ -
source:
template <bool V>
void fn2();

extern template void fn2<false>();

void fn3();

void fn()
{
  fn2<false>();
  fn3();
}

template <bool V>
void fn2()
{
}

template void fn2<false>();

It generates
        subq    $8, %rsp
        call    void fn2<false>()
        addq    $8, %rsp
        jmp     fn3()
It should generate
        jmp     fn3()
Comment 1 Andrew Pinski 2016-06-26 06:33:32 UTC
Confirmed.