[SystemZ] Fixes in the backend I/R.
authorJonas Paulsson <jonas.paulsson@ericsson.com>
Sat, 10 Oct 2015 07:14:24 +0000 (07:14 +0000)
committerJonas Paulsson <jonas.paulsson@ericsson.com>
Sat, 10 Oct 2015 07:14:24 +0000 (07:14 +0000)
expandPostRAPseudo():
STX -> 2 * STD: The first STD should not have the kill flag set for the address.

SystemZElimCompare:
BRC -> BRCT conversion: Don't forget to remove the CC<use,kill> operand.

Needed to make SystemZ/asm-17.ll pass with -verify-machineinstrs, which
now runs with this flag.

Reviewed by Ulrich Weigand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249945 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SystemZ/SystemZElimCompare.cpp
lib/Target/SystemZ/SystemZInstrInfo.cpp
test/CodeGen/SystemZ/asm-17.ll

index 5daa4d77671d17fba216e161b3050c72686d1071..adddeef00905d6f1ce6f1fc06859bf81d7cccacc 100644 (file)
@@ -206,9 +206,8 @@ SystemZElimCompare::convertToBRCT(MachineInstr *MI, MachineInstr *Compare,
 
   // The transformation is OK.  Rebuild Branch as a BRCT(G).
   MachineOperand Target(Branch->getOperand(2));
-  Branch->RemoveOperand(2);
-  Branch->RemoveOperand(1);
-  Branch->RemoveOperand(0);
+  while (Branch->getNumOperands())
+    Branch->RemoveOperand(0);
   Branch->setDesc(TII->get(BRCT));
   MachineInstrBuilder(*Branch->getParent()->getParent(), Branch)
     .addOperand(MI->getOperand(0))
index a319e1c6aa8f7be4f2ba234c81c20f97f57b3ea5..5d7accc6c0ecbd91657557a5d760a75f8116c09a 100644 (file)
@@ -69,6 +69,9 @@ void SystemZInstrInfo::splitMove(MachineBasicBlock::iterator MI,
   MachineOperand &LowOffsetOp = MI->getOperand(2);
   LowOffsetOp.setImm(LowOffsetOp.getImm() + 8);
 
+  // Clear the kill flag for the address reg in the first instruction.
+  EarlierMI->getOperand(1).setIsKill(false);
+
   // Set the opcodes.
   unsigned HighOpcode = getOpcodeForOffset(NewOpcode, HighOffsetOp.getImm());
   unsigned LowOpcode = getOpcodeForOffset(NewOpcode, LowOffsetOp.getImm());
index 533b5e90d62d45e84f5039dd7614594b8a89f3fb..acf2aff4542923ffb849df2b58524459c539a4f0 100644 (file)
@@ -1,6 +1,7 @@
 ; Test explicit register names.
 ;
-; RUN: llc < %s -mtriple=s390x-linux-gnu -no-integrated-as | FileCheck %s
+; RUN: llc < %s  -verify-machineinstrs -mtriple=s390x-linux-gnu -no-integrated-as \
+; RUN:   | FileCheck %s
 
 ; Test i32 GPRs.
 define i32 @f1() {