[llvm] r363665 - [SystemZ] Fix AHIMuxK pseudo expansion.
Jonas Paulsson via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 05:10:02 PDT 2019
Author: jonpa
Date: Tue Jun 18 05:10:02 2019
New Revision: 363665
URL: http://llvm.org/viewvc/llvm-project?rev=363665&view=rev
Log:
[SystemZ] Fix AHIMuxK pseudo expansion.
Do not emit a copy if the source and destination registers are the same.
Review: Ulrich Weigand
Added:
llvm/trunk/test/CodeGen/SystemZ/int-add-18.mir
Modified:
llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp
Modified: llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp?rev=363665&r1=363664&r2=363665&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp Tue Jun 18 05:10:02 2019
@@ -168,11 +168,13 @@ void SystemZInstrInfo::expandRIEPseudo(M
if (!DestIsHigh && !SrcIsHigh)
MI.setDesc(get(LowOpcodeK));
else {
- emitGRX32Move(*MI.getParent(), MI, MI.getDebugLoc(), DestReg, SrcReg,
- SystemZ::LR, 32, MI.getOperand(1).isKill(),
- MI.getOperand(1).isUndef());
+ if (DestReg != SrcReg) {
+ emitGRX32Move(*MI.getParent(), MI, MI.getDebugLoc(), DestReg, SrcReg,
+ SystemZ::LR, 32, MI.getOperand(1).isKill(),
+ MI.getOperand(1).isUndef());
+ MI.getOperand(1).setReg(DestReg);
+ }
MI.setDesc(get(DestIsHigh ? HighOpcode : LowOpcode));
- MI.getOperand(1).setReg(DestReg);
MI.tieOperands(0, 1);
}
}
Added: llvm/trunk/test/CodeGen/SystemZ/int-add-18.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/int-add-18.mir?rev=363665&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/int-add-18.mir (added)
+++ llvm/trunk/test/CodeGen/SystemZ/int-add-18.mir Tue Jun 18 05:10:02 2019
@@ -0,0 +1,20 @@
+# RUN: llc -mtriple=s390x-linux-gnu -mcpu=z13 -start-before=postrapseudos \
+# RUN: %s -o - | FileCheck %s
+#
+# Test that an AHIMuxK pseudo does not result in a COPY (risbhg) if the
+# source and destination registers are the same.
+
+---
+name: fun
+tracksRegLiveness: true
+body: |
+ bb.0:
+ $r1h = IIHF 0
+ renamable $r1h = nuw nsw AHIMuxK killed renamable $r1h, 4, implicit-def dead $cc
+
+ ; CHECK-LABEL: fun
+ ; CHECK-NOT: risbhg
+ ; CHECK: aih %r1, 4
+...
+
+
More information about the llvm-commits
mailing list