[clang] [clang][CodeGen] Use byval for SystemZ indirect arguments (PR #66404)

Ilya Leoshkevich via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 14 16:08:08 PDT 2023


iii-i wrote:

I just checked with a few small examples, and while the ABI does not seem to change, the code generation looks broken for tail recursion:

```
$ cat 1.c
void baz(long double);
void quux(void) { baz((long double)1); }

$ ./bin/clang -O3 -S 1.c

$ cat 1.s
[...]
        aghi    %r15, -176      # stack frame
        larl    %r1, .LCPI0_0   # address of (long double)1 in the literal pool
        lxeb    %f0, 0(%r1)     # f0:f2=(long double)1
        la      %r2, 160(%r15)  # r2=&var_160
        std     %f0, 160(%r15)  # var_160=(long double)1
        std     %f2, 168(%r15)
        aghi    %r15, 176       # var_160 is above the stack pointer now!
        jg      baz at PLT         # baz(&var_160)
[...]
```

Regarding MSan/DFSan, they need to know whether to copy value's or pointer's shadow into arguments' TLS. MSan already has checks for that (`CB.paramHasAttr(ArgNo, Attribute::ByVal)`), and for DFSan I've added them in my local branch.

https://github.com/llvm/llvm-project/pull/66404


More information about the cfe-commits mailing list