[Bug tree-optimization/51680] g++ 4.7 fails to inline trivial template stuff

miles at gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jan 9 05:36:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51680

--- Comment #18 from miles at gnu dot org 2013-01-09 05:35:35 UTC ---
Is this considered fixed yet?  Given the following example, the latest Debian
trunk snapshot ("4.8.0 20121120 (experimental) [trunk revision 193662]", using
flags "-O2") seems to do a good job inlining this code well, even with many
calls (whereas 4.7 does not, once the number of calls goes beyond 3-4 or so):

    extern void process (float);                                                
    template<typename Fun, typename T>
    void process_fun_at (const Fun &fun, T x)
    {
      process (fun (x));
    }
    static float add1 (float x)
    {
      return x + 1;
    }
    void test0 (float i) { process_fun_at (add1, i); }                          
    void test1 (float i) { process_fun_at (add1, i); }
    void test2 (float i) { process_fun_at (add1, i); }
    void test3 (float i) { process_fun_at (add1, i); }
    void test4 (float i) { process_fun_at (add1, i); }
    void test5 (float i) { process_fun_at (add1, i); }
    void test6 (float i) { process_fun_at (add1, i); }
    void test7 (float i) { process_fun_at (add1, i); }
    void test8 (float i) { process_fun_at (add1, i); }
    void test9 (float i) { process_fun_at (add1, i); }
    void test10 (float i) { process_fun_at (add1, i); }
    void test11 (float i) { process_fun_at (add1, i); }
    void test12 (float i) { process_fun_at (add1, i); }
    void test13 (float i) { process_fun_at (add1, i); }
    void test14 (float i) { process_fun_at (add1, i); }
    void test15 (float i) { process_fun_at (add1, i); }
    void test16 (float i) { process_fun_at (add1, i); }
    void test17 (float i) { process_fun_at (add1, i); }
    void test18 (float i) { process_fun_at (add1, i); }
    void test19 (float i) { process_fun_at (add1, i); }



More information about the Gcc-bugs mailing list