Closed
Description
For the below trivial C code, the oraFoo() function is passing all const args as numeric zero at all optimization level other than -O0. Even though the args not used in callee, there is no benefits of loading reg with numeric ZERO rather than its actual value.
#include <stdio.h>
typedef unsigned char ub1;
void oraSetRegInfo(ub1);
void __attribute__((noinline)) oraBar(ub1 var1, ub1 var2, ub1 var3, ub1 var4,
ub1 var5, ub1 var6, ub1 var7,
ub1 var8, ub1 var9)
{
oraSetRegInfo(var9);
}
void __attribute__((noinline)) oraFoo()
{
ub1 var = 255;
oraBar(10, 20, 30, 40, 50, 60, 70, 80, var);
}
Please see the example assembly code here, https://godbolt.org/z/Kcqz7Enen