Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Rakesh_M_
Beginner
155 Views

Optimization Report: Generated "DEAD STATIC FUNCTION" for both used and unused function

Hi,

Here I have a code containing two functions of small size, according to the condition either of them will be executed. When you generate IPO optimization report, it should report you "DEAD STATIC FUNCTION"  for the function that is not used; but when I generated the report, it has shown the same for both the functions. Why is it? How to resolve it? and What is the list of different reporting elements that can be shown at "-qopt-report=5" ? Please post references that has clear details about the list of elements.

Here is my sample code and optimization report:

void fun1()
		{
			int a=12,b=12,c;
			c=a+b;
			printf("\nFUN1 is Called: c = %d\n",c);			
		}
		
		void fun2()
		{
			int a=12,b=12,c;
			c=a*b;
			printf("\nFUN2 is Called: c = %d\n",c);			
		}		
int main()
{
       int x=20;
       
        if(x==20)
	{
		fun1(); // This is the one called. So, it should not generate DEAD STATIC FUNCTION for this.
	}
       else
	{
		fun2(); // It should generate DEAD STATIC FUNCTION only for this
	}

}

and here is the report:

Begin optimization report for: main()

    Report from: Interprocedural optimizations [ipo]

INLINE REPORT: (main()) [1/3=33.3%] gl_opt.c(27,1)
  -> EXTERN: (132,3) printf(const char *__restrict__, ...)
  -> INLINE: (163,4) fun1() (isz = 8) (sz = 11)
    -> EXTERN: (138,4) printf(const char *__restrict__, ...)
  -> INLINE: (167,4) fun2() (isz = 8) (sz = 11)
    -> EXTERN: (145,4) printf(const char *__restrict__, ...)

===========================================================================

Begin optimization report for: fun2()

    Report from: Interprocedural optimizations [ipo]

DEAD STATIC FUNCTION: (fun2()) gl_opt.c(142,3)

===========================================================================

Begin optimization report for: fun1()

    Report from: Interprocedural optimizations [ipo]

DEAD STATIC FUNCTION: (fun1()) gl_opt.c(135,3)

===========================================================================

Thank you

0 Kudos
2 Replies
Anoop_M_Intel
Employee
155 Views

Hi Rakesh,

I tried compiling this code with Intel C++ Compiler 16.0.3 and I see the following report:

Begin optimization report for: main()

    Report from: Interprocedural optimizations [ipo]

INLINE REPORT: (main()) [1/3=33.3%] testforum.cc(16,1)
  -> INLINE: (21,3) fun1() (isz = 8) (sz = 11)
    -> EXTERN: (6,4) printf(const char *, ...)
  -> INLINE: (25,3) fun2() (isz = 8) (sz = 11)
    -> EXTERN: (13,4) printf(const char *, ...)

===========================================================================

Begin optimization report for: fun1()

    Report from: Interprocedural optimizations [ipo]

INLINE REPORT: (fun1()) [2/3=66.7%] testforum.cc(3,3)
  -> EXTERN: (6,4) printf(const char *, ...)

===========================================================================

Begin optimization report for: fun2()

    Report from: Interprocedural optimizations [ipo]

INLINE REPORT: (fun2()) [3/3=100.0%] testforum.cc(10,3)
  -> EXTERN: (13,4) printf(const char *, ...)

===========================================================================

Which version of the C++ Compiler are you using and is this on Linux or Windows?

Thanks and Regards
Anoop

Rakesh_M_
Beginner
155 Views

Hi Anoop Madhusoodhanan Prabha (Intel),

I have used icc version 16.0.0 compiler for this code. Could you please help me out at what instances does report shows this "Dead Static Function" element, like will it throw only for conditional execution of the function or any other instances?

Thank you

Reply