Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

Include dead code elimination in optimization report

Andrey_Vladimirov
New Contributor III
422 Views

As of Intel C/C++ compiler version 14.0.2.144, is it possible to make optimization report print out information on dead code elimination decisions? I have a case where I suspect that dead code elimination occurs. I have scrutinized the compiler output with "-opt-report=3", but could not find any hints on dead code elimination.

 

0 Kudos
2 Replies
KitturGanesh
Employee
422 Views

Hi,
The interprocedural phase should optimize for dead code if any in the application. The option "-opt-report-phase=ipo -opt-report=2" should ouput the routines that were dead and eliminated.

_Kittur

0 Kudos
KitturGanesh
Employee
422 Views

Hi Andrey,

If you meant just a piece of code within a routine, we have never reported this in the opt report, and don’t have any plans at the moment to do that in future releases.  

But if you meant dead function elimination, then you can just use -opt-report

For example:

%cat t.c
static int foo()
{
   return 5;

extern int main()
{
   return foo(); 


%icc t.c -opt-report

<;-1:-1;IPO ROUTINE ATTRIBUTES PROPAGATION;;0>
  ROUTINE ATTRIBUTE PROPAGATION TOTALS:

      RDECL: NSE(0->0) AR(0->0) NORET(0->0) DR(0->0) NT(0->0)
      RDECL: MF(0->0) OMPPAR(0->0)
.....
.....

<t.c;-1:-1;IPO DEAD STATIC FUNCTION ELIMINATION;foo;0>
DEAD STATIC FUNCTION ELIMINATION:
  (foo)
  Routine was called explicity


<t.c;-1:-1;PGO;main;0>
  STATIC:t.c  main

<t.c;-1:-1;PGO;foo;0>
  STATIC:t.c  foo

<;-1:-1;PGO;;0>

      2 FUNCTIONS HAD VALID STATIC PROFILES

  IPO CURRENT  QUALITY METRIC:  50.0%
  IPO POSSIBLE QUALITY METRIC:  50.0%
  IPO QUALITY  METRIC RATIO:   100.0%


Hope the above answers your question

_Kittur

0 Kudos
Reply