[X86] In EFLAGS copy pass, don't emit EXTRACT_SUBREG instructions since we're after...
authorCraig Topper <craig.topper@intel.com>
Thu, 16 Aug 2018 21:54:02 +0000 (21:54 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 16 Aug 2018 21:54:02 +0000 (21:54 +0000)
commitbde2b43cb3386534dc2f66d6de29567cf1347b9d
tree7bbf30342d07c0e0ddb8b12b35d6744ab3a8a7e6
parenta6c34887f70d43d733157650d4c16a426574e868
[X86] In EFLAGS copy pass, don't emit EXTRACT_SUBREG instructions since we're after peephole

Normally the peephole pass converts EXTRACT_SUBREG to COPY instructions. But we're after peephole so we can't rely on it to clean these up.

To fix this, the eflags pass now emits a COPY with a subreg input.

I also noticed that in 32-bit mode we need to constrain the input to the copy to ensure the subreg is valid. Otherwise we'll fail verify-machineinstrs

Differential Revision: https://reviews.llvm.org/D50656

llvm-svn: 339945
llvm/lib/Target/X86/X86FlagsCopyLowering.cpp
llvm/test/CodeGen/X86/flags-copy-lowering.mir
llvm/test/CodeGen/X86/pr38539.ll [new file with mode: 0644]