I have a C function like below which is part of a file xyz.c and the file is compile using O2 optimization using gcc. The function GetValue() is called almost 200million times to generate specific data. But for this specific operation cond1 is passed as false, hence code under this condition is never exercise. But, why there is lot of CPU difference in executing GetValue function, when the code chunk 'abc' is commented vs un-commented eventhough the code in that block under (cond1 == true) is not exercised at all.
if the code is commented then GetValue() take - 100 cpu seconds
uncomented then GetValue() take - 120 cpu seconds why ? Is there any problem with GCC optimization ?
inline GetValue(int cond1)
if (cond1 == true)
// -- code chunk 'abc'--