oskarwirga wrote:

Apologies for still not being able to create a reproducible example I can share 
but what I am seeing is the stack probe write overwriting the value at  the tip 
of the stack when I step debug execution:
```
str     xzr, [sp, #-0x10 {var_70}]!  {0x0}
...
stur    x8, [x29, #-0x10 {var_70}]
...
from the inlined function:
str     xzr, [x20]  {0x0}
mov     sp, x20
...
ldur    x8, [x29, #-0x10 {var_70}] << null deref
```

I also was able to isolate the issue to the non-fast register allocators. When 
building with optimized code, the greedy register allocator and the basic 
register allocator ended up choosing registers that were being clobbered (? 
don't know the term) by the stack probe write. 

> All the stack probing should have already finished before the call to 
> `malloc`.

Only for the containing function, the functions which have their stack probes 
inlined will be in the middle of the function which then results in this 
null-deref. I think there's some re-arranging happening during optimization and 
inlining which causes the registers not to be expired (? don't know the term 
here)

> Just to make things simpler, can you try disabling the shrink-wrapping and 
> see what happens?

I haven't seen noticeable difference with this, I tried passing it in with 
`-Wl,-mllvm,-enable-shrink-wrap=false`  

https://github.com/llvm/llvm-project/pull/66524
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to