Pretty simple. Just write some trash value into all registers in the prolog that aren't preserved by the function's calling convention. We can add a function attribute to control this. This feature could help stress test things like - liveness across call site - a managed runtime that saves/restores context around calls to native code - the stack map liveness feature that reports In the case of stackmap liveness, we could clobber dead registers at the point of the stackmap to verify our own analysis. This would be a more direct way to verify the liveness analysis. There is some speculation that this could harden code against security vulnerabilities, but I haven't confirmed that. For my immediate goals, verification in the runtime may be sufficient. But I want to float the idea early of having LLVM generate clobber regs to get input from others.
To be clear, we can do this (a) in the prolog for all caller-saves (b) in the epilog for all caller-saves (c) around call sites for dead callee-saves
FWIW, V8 and lots of JITs do this in debug modes, so it seems useful to me.