summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/CodeGen/ExpandPostRAPseudos.cpp2
-rw-r--r--llvm/test/CodeGen/X86/expand-post-ra-pseudo.mir11
2 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/ExpandPostRAPseudos.cpp b/llvm/lib/CodeGen/ExpandPostRAPseudos.cpp
index bc747fc610f..f2a2bcbb94b 100644
--- a/llvm/lib/CodeGen/ExpandPostRAPseudos.cpp
+++ b/llvm/lib/CodeGen/ExpandPostRAPseudos.cpp
@@ -97,6 +97,8 @@ bool ExpandPostRA::LowerSubregToReg(MachineInstr *MI) {
if (MI->allDefsAreDead()) {
MI->setDesc(TII->get(TargetOpcode::KILL));
+ MI->RemoveOperand(3); // SubIdx
+ MI->RemoveOperand(1); // Imm
LLVM_DEBUG(dbgs() << "subreg: replaced by: " << *MI);
return true;
}
diff --git a/llvm/test/CodeGen/X86/expand-post-ra-pseudo.mir b/llvm/test/CodeGen/X86/expand-post-ra-pseudo.mir
new file mode 100644
index 00000000000..ffc3fd6ce0d
--- /dev/null
+++ b/llvm/test/CodeGen/X86/expand-post-ra-pseudo.mir
@@ -0,0 +1,11 @@
+# RUN: llc -o - %s -mtriple=x86_64-- -run-pass=postrapseudos | FileCheck %s
+---
+# CHECK-LABEL: name: func
+name: func
+body: |
+ bb.0:
+ liveins: $eax
+ ; CHECK-NOT: dead $rax = KILL {{[0-9]+}}
+ ; CHECK: dead $rax = KILL killed $eax
+ dead $rax = SUBREG_TO_REG 0, killed $eax, %subreg.sub_32bit
+...
OpenPOWER on IntegriCloud