zero-call-used-regs pass generate an xor instruction to help mitigate
return-oriented programming exploits via zeroing out used registers. But
in this below test case with -g option there is dbg.value instruction
associating the register with the debug-info description of the formal
parameter d, which makes the register appear used, therefore it zero the
register edi in -g case and makes binary different from without -g option.
The pass should be looking only at the non-debug uses.
$ cat test.c
char a[];
int b;
attribute((zero_call_used_regs("used"))) char c(int d) {
*a = ({ int e = d; b; });
}
This fixes https://github.com/llvm/llvm-project/issues/57962.
Need some curly braces on this loop now? (& the indentation of the isDebugStr check looks like it's off-by-one)