[PATCH] Fix for codegen bug that could cause illegal cmn instruction generation

Louis Gerbarg lgg at apple.com
Tue Apr 8 10:13:26 PDT 2014


Attached are two patches. The first adds a flag to disable the dead register definition pass in the ARM64 backend, which was helpful to me while diagnosing this issue. In the second patch.

The second is a patch to fix a bug caused by an interaction between the dead register definition pass and the the code that materializes frame indexed operands that could can cause illegal instructions to be generated in the case of large stack frames. Essentially what happened is that in some cases the instruction that was being used to calculate the address of the frame indexed value would need to be expanded into multiple instructions, which ends up expanding into multiple adds into the definition register.  If the register was not used for anything else then the dead definition pass had already removed and replaced that with the zero register, which means that when that expansion reused the definition as an intermediary the zero register ends up as a source for a CMN (ADDS) instruction, which is illegal. This patch tests to see if any of the operands an instruction are frame indexes.

Test case included with the second patch.

Louis

 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-a-flag-to-disable-the-ARM64DeadRegisterDefinitio.patch
Type: application/octet-stream
Size: 1759 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140408/7588144b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Fix-for-codegen-bug-that-could-cause-illegal-cmn-ins.patch
Type: application/octet-stream
Size: 6079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140408/7588144b/attachment-0001.obj>


More information about the llvm-commits mailing list