[llvm-commits] [PATCH][Review request] Fix bug in CriticalAntiDepBreaker

Hatanaka, Akira ahatanaka at mips.com
Wed May 23 10:37:58 PDT 2012


The attached patch fixes bug 12829.

http://llvm.org/bugs/show_bug.cgi?id=12829

The problem is that CriticalAntiDepBreaker rewrites a register operand of a call instruction. The comment in CriticalAntiDepBreaker::PrescanInstruction explicitly states that it is not safe to change call instructions' register operands and the piece of code near the end of CriticalAntiDepBreaker::PrescanInstruction sets flags in KeepRegs to prevent the register operands from being changed. The registers are changed later anyway because the flags for the clobbered registers of a register mask are cleared in CriticalAntiDepBreaker::ScanInstruction.

The patch fixes this bug by moving the piece of code that sets KeepRegs in CriticalAntiDepBreaker::PrescanInstruction to CriticalAntiDepBreaker::ScanInstruction.

Also, it replaces "MI->getDesc().getNumOperands()" with "MI->getNumOperands()" to have NewRC set for variable operands as well as for fixed operands.

The tests that were previously failing pass after this patch is applied.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120523/54ef9a65/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: antidepbreaker.patch
Type: text/x-patch
Size: 2758 bytes
Desc: antidepbreaker.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120523/54ef9a65/attachment.bin>


More information about the llvm-commits mailing list