<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/118474>118474</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [PowePC] Incorrect const loaded while passing args
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          IshwaraK
      </td>
    </tr>
</table>

<pre>
    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




</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2P4zYM_TXyhZjApvyRHHzIZMbAYA872N56GcgybatQpFSSnc78-kJK0qQfQLGGQBPQI_n4QFF4ryZD1LLqmVUvmVjCbF375uezcOJb1tvhs-2sgzAT9KTtGYJTqxIaDiDtQAwP6c460VnLcMtwB-NiZFDWgPJwiiXMBEJrkNb4AMJNHoQHsxzJKQlf5CyIkBD2FNRRfYkUrWklDTbMFOsLA0_f8w28rmQgzHaZ5lQ5pTM2wOJpAGVACq3pRsxRJGEs9GRoVMGDHUFbMUROjiY4qzD_ReXX1x_fwYl7xRggZFiEhlXohTYs38dT59eT7xlyZaReBgLGDz4Mym5mxl8vyPB5ooFGWEwSegA5CwdLXzD-zPL9atUQtfuFwg-a3swYJYy3uLsAbpiPDxGCU_0S6OMjybw1VhmtDEUs7mKWZ-Eu4bAKV0QFrj4--PzBLxkeWL6H__iuiOoBXT_4zf9Gbh_QkWBspokt_avfG-DScPPys23fB-9e41YZGH8BrKpLcrirVOSRHybLky2TrZKtk22S3Sa7xqi_c3wcgnz_rkl4Ak-UxpL-EMeTJhDe07HXn-m1QBzImG0O4eQZ3zPsGHaTHXqrw8a6iWH3xbD7Jn__al4Nmeu8pZMNLR92fCcyaouGc8S6aepsbisuRM9J7uotl0XPqwbL7Q5LOZQch1xmqsUcywJzXhQVVvWmGXcjz7EeRN7XIy9YmdNRKL3Rej1GHpnyfqG2KLZlU2Za9KR9WhKIhs6Qbhli3BmujUFP_TJ5VuZa-eDvaYIKOm2Xd3um9wOrXuDNSOscyXDdB_E10gDnWWm6rws3-Wxxuv2HUirMS7-R9siwi0Wuv6eTs7-RDAy7RM0z7K7c1xb_DAAA__80AH6X">