Skip to content

[PowerPC] Incorrect const loaded into reg while passing args #118474

Closed
@IshwaraK

Description

@IshwaraK

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions