This is an experimental patch that changes the way we
instrument stack variables: instead of merging all static alloca
instructions into one large static alloca, we merge them into
one *dynamic* alloca. There are two main reasons for that:
- We significantly reduce the stack usage in "use-after-return"
mode. Currently, large static alloca is just unused in use-after-return
mode, as we actually use "fake stack" allocated by the ASan runtime.
- It can improve debug info for local variables, as their location
will now be calculated via %rbx register, not %rsp, that is assumed
to be clobbered by function calls.
I'm still running a SPEC for this patch to see if it slows down ASan
on benchmarks. I've also ran it on a large internal codebase, and it
unveiled numerous problems. I see problems with inline assembly
(e.g. inline assembly code for fetching cpuid doesn't properly
save/restore %rbx, or compile errors of the form "inline assembly requires
more registers than available"). I also see several runtime errors
on -O2 level, which I haven't debugged yet.
Sadly, deployment of this change will be hard (if possible). Still,
you're welcome to experiment with this patch and see if it solves
some problems you observe (esp. debug info issues).
HasNonEmptyInlineAsm?