Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1097821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:29:12+00:00 2026-05-17T00:29:12+00:00

In GCC compiler, whenever -O3 is flagged, the compiler optimizes mainly by Loop Unrolling

  • 0

In GCC compiler, whenever -O3 is flagged, the compiler optimizes mainly by Loop Unrolling and Function Inlining.

However, when I compiled an application that has the following function, it didn’t do Function Inlining. From gprofing and gconving I could notice that this function (comp_t_delay) was not called from the main function unit of this application. However, it was called from a function, called by a function, called by the main function.

Here is the code of comp_t_delay(int in,int ip) that I want to know why the GCC didn’t optimize it using -O3 (any help is appreciated!):

static float
comp_t_delay(int in,int ip)
{

    int sb, sib,dx, dy;
    t_type_ptr st, sit;
    float d_ssi;

    d_ssi = 0.;

    sb = net[in].node_block[0];
    st = block[sb].type;

    sib = net[in].node_block[ip];
    sit = block[sib].type;

    assert(st != NULL);
    assert(sit != NULL);

    dx = abs(block[sib].x - block[sb].x);
    dy = abs(block[sib].y - block[sb].y);

    if(st == T_IO)
    {
        if(sit == T_IO)
        d_ssi = de_io[dx][dy];
        else
        d_ssi = de_iof[dx][dy];
    }
    else
    {
        if(sit == T_IO)
        d_ssi = de_fio[dx][dy];
        else
        d_ssi = de_fb[dx][dy];
    }
    if(d_ssi < 0)
    {
        printf
        ("Error1\n");
        exit(1);
    }

    if(d_ssi < 0.)
    {
        printf
        ("Error2\n");
        exit(1);
    }

    return (d_ssi);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:29:13+00:00Added an answer on May 17, 2026 at 12:29 am

    It most probably didn’t inline it because it is too long. Long functions, when inlined, can actually cause the code to run slower – for example you get the CPU registers bloated by more variables. In this particular case gcc decided it will be faster not to inline the function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.