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

In PGO: can I add one or two lines after phase 2?

maverick6664
Beginner
262 Views
I'm thinking of writing some notification in the phase 3 executable in a PGO optimized application on Linux. Exactly speaking, I just want to add one line "fprintf(stderr,"some info about what I did on instrumented executions...how many times, how about the results, etc.");"

Does it affect the PGO? As far as I hexdumped *.dyn files, they seem (just a guess) to hold the file names and a function name associated with each of them (and maybe when, how many times, etc..) So I suppose it doesn't matter...at least in phase 1,2, IPO isn't enabled...

But to make it sure, I put "fprintf(stderr,"blah blah");" in phase 1, and will just modify the string in fprintf in phase 3. I don't think it affects PGO.

So will anyone tell me what modifications in the source affects PGO and what doesn't?

Thanks in advance!
0 Kudos
2 Replies
Maximillia_D_Intel
262 Views
I believe there's a check in the compiler to see if the number of internal basic blocks have changed between the code when -prof_gen was usedand the code when -prof_use is called. Adding a function call to a routine would result in an extra basic block being added so I believe (if I understand your thread correctly) you would not be able to reuse a profile if you added an additional call to a function during the -prof_use phase.
I suppose you could always try a simple testcase and find out. You'll get a diagnostic if the -prof_use phase cannot use the profile.
Max
0 Kudos
maverick6664
Beginner
262 Views
Thank you. I tried and found adding a function didn't work, but modifying the string in fprintf would be fine.

Thank you very much!!
0 Kudos
Reply