llvm-6502/lib
James Molloy bb96dfcf4f MachineCopyPropagation has special logic for removing COPY instructions. It will remove plain COPYs using eraseFromParent(), but if the COPY has imp-defs/imp-uses it will convert it to a KILL, to keep the imp-def around.
This actually totally breaks and causes the machine verifier to cry in several cases, one of which being:

%RAX<def> = COPY %RCX<kill>
%ECX<def> = COPY %EAX<kill>, %RAX<imp-use,kill>

These subregister copies are together identified as noops, so are both removed. However, the second one as it has an imp-use gets converted into a kill:

%ECX<def> = KILL %EAX<kill>, %RAX<imp-use,kill>

As the original COPY has been removed, the verifier goes into tears at the use of undefined EAX and RAX.

There are several hacky solutions to this hacky problem (which is all to do with imp-use/def weirdnesses), but the least hacky I've come up with is to *always* remove COPYs by converting to KILLs. KILLs are no-ops to the code generator so the generated code doesn't change (which is why they were partially used in the first place), but using them also keeps the def/use and imp-def/imp-use chains alive:

%RAX<def> = KILL %RCX<kill>
%ECX<def> = KILL %EAX<kill>, %RAX<imp-use,kill>

The patch passes all test cases including the ones that check the removal of MOVs in this circumstance, along with an extra test I added to check subregister behaviour (which made the machine verifier fall over before my patch).

The patch also adds some DEBUG() statements because the file hadn't got any.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199797 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-22 09:12:27 +00:00
..
Analysis [PM] Make the verifier work independently of any pass manager. 2014-01-19 02:22:18 +00:00
AsmParser Add an inalloca flag to allocas 2014-01-17 23:58:17 +00:00
Bitcode Make parseBitcodeFile return an ErrorOr<Module *>. 2014-01-15 01:08:23 +00:00
CodeGen MachineCopyPropagation has special logic for removing COPY instructions. It will remove plain COPYs using eraseFromParent(), but if the COPY has imp-defs/imp-uses it will convert it to a KILL, to keep the imp-def around. 2014-01-22 09:12:27 +00:00
DebugInfo Change createObjectFile to return an ErrorOr. 2014-01-22 00:14:49 +00:00
ExecutionEngine Change createObjectFile to return an ErrorOr. 2014-01-22 00:14:49 +00:00
IR [PM] Wire up the Verifier for the new pass manager and connect it to the 2014-01-20 11:34:08 +00:00
IRReader Make parseBitcodeFile return an ErrorOr<Module *>. 2014-01-15 01:08:23 +00:00
Linker Reapply r194218 with fix: 2014-01-16 06:29:36 +00:00
LTO Adding new LTO APIs to parse metadata nodes and extract linker options and 2014-01-21 18:31:27 +00:00
MC Tweak the MCExternalSymbolizer to not use the SymbolLookUp() call back 2014-01-21 00:23:17 +00:00
Object Change createObjectFile to return an ErrorOr. 2014-01-22 00:14:49 +00:00
Option
Support [x86] Support i386-*-*-code16 triple for emitting 16-bit code 2014-01-20 12:02:25 +00:00
TableGen
Target [AArch64 NEON] Try to generate CONCAT_VECTOR when lowering BUILD_VECTOR or SHUFFLE_VECTOR. 2014-01-22 06:11:03 +00:00
Transforms [SROA] Fix a bug which could cause the common type finding to return 2014-01-21 23:16:05 +00:00
CMakeLists.txt Move LTO support library to a component, allowing it to be tested 2013-09-24 23:52:22 +00:00
LLVMBuild.txt Move LTO support library to a component, allowing it to be tested 2013-09-24 23:52:22 +00:00
Makefile Reformat Makefile. No other changes. 2013-10-30 04:03:03 +00:00