Blame SOURCES/0001-SystemZ-Use-LA-instead-of-AGR-in-eliminateFrameIndex.patch

158546
From d851495f2fe614c4c860bda1bd3c80bfbe48360b Mon Sep 17 00:00:00 2001
158546
From: Jonas Paulsson <paulsson@linux.vnet.ibm.com>
158546
Date: Thu, 8 Oct 2020 13:18:29 +0200
158546
Subject: [PATCH] [SystemZ] Use LA instead of AGR in eliminateFrameIndex().
158546
158546
Since AGR clobbers CC it should not be used here.
158546
158546
Fixes https://bugs.llvm.org/show_bug.cgi?id=47736.
158546
158546
Review: Ulrich Weigand
158546
Differential Revision: https://reviews.llvm.org/D89034
158546
---
158546
 .../Target/SystemZ/SystemZRegisterInfo.cpp    |  4 +--
158546
 llvm/test/CodeGen/SystemZ/frame-14.ll         | 26 +++++++++----------
158546
 llvm/test/CodeGen/SystemZ/frame-16.ll         |  4 +--
158546
 3 files changed, 17 insertions(+), 17 deletions(-)
158546
158546
diff --git a/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp b/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp
158546
index 53b06c6e7e6d..88212e52460f 100644
158546
--- a/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp
158546
+++ b/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp
158546
@@ -322,8 +322,8 @@ SystemZRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator MI,
158546
         // Load the high offset into the scratch register and use it as
158546
         // an index.
158546
         TII->loadImmediate(MBB, MI, ScratchReg, HighOffset);
158546
-        BuildMI(MBB, MI, DL, TII->get(SystemZ::AGR),ScratchReg)
158546
-          .addReg(ScratchReg, RegState::Kill).addReg(BasePtr);
158546
+        BuildMI(MBB, MI, DL, TII->get(SystemZ::LA), ScratchReg)
158546
+          .addReg(BasePtr, RegState::Kill).addImm(0).addReg(ScratchReg);
158546
       }
158546
 
158546
       // Use the scratch register as the base.  It then dies here.
158546
diff --git a/llvm/test/CodeGen/SystemZ/frame-14.ll b/llvm/test/CodeGen/SystemZ/frame-14.ll
158546
index e70731249b42..193ff81123c5 100644
158546
--- a/llvm/test/CodeGen/SystemZ/frame-14.ll
158546
+++ b/llvm/test/CodeGen/SystemZ/frame-14.ll
158546
@@ -85,13 +85,13 @@ define void @f3() {
158546
 define void @f4() {
158546
 ; CHECK-NOFP-LABEL: f4:
158546
 ; CHECK-NOFP: llilh %r1, 8
158546
-; CHECK-NOFP: agr %r1, %r15
158546
+; CHECK-NOFP: la %r1, 0(%r1,%r15)
158546
 ; CHECK-NOFP: mvi 0(%r1), 42
158546
 ; CHECK-NOFP: br %r14
158546
 ;
158546
 ; CHECK-FP-LABEL: f4:
158546
 ; CHECK-FP: llilh %r1, 8
158546
-; CHECK-FP: agr %r1, %r11
158546
+; CHECK-FP: la %r1, 0(%r1,%r11)
158546
 ; CHECK-FP: mvi 0(%r1), 42
158546
 ; CHECK-FP: br %r14
158546
   %region1 = alloca [524104 x i8], align 8
158546
@@ -108,13 +108,13 @@ define void @f4() {
158546
 define void @f5() {
158546
 ; CHECK-NOFP-LABEL: f5:
158546
 ; CHECK-NOFP: llilh %r1, 8
158546
-; CHECK-NOFP: agr %r1, %r15
158546
+; CHECK-NOFP: la %r1, 0(%r1,%r15)
158546
 ; CHECK-NOFP: mvi 4095(%r1), 42
158546
 ; CHECK-NOFP: br %r14
158546
 ;
158546
 ; CHECK-FP-LABEL: f5:
158546
 ; CHECK-FP: llilh %r1, 8
158546
-; CHECK-FP: agr %r1, %r11
158546
+; CHECK-FP: la %r1, 0(%r1,%r11)
158546
 ; CHECK-FP: mvi 4095(%r1), 42
158546
 ; CHECK-FP: br %r14
158546
   %region1 = alloca [524104 x i8], align 8
158546
@@ -130,13 +130,13 @@ define void @f5() {
158546
 define void @f6() {
158546
 ; CHECK-NOFP-LABEL: f6:
158546
 ; CHECK-NOFP: llilh %r1, 8
158546
-; CHECK-NOFP: agr %r1, %r15
158546
+; CHECK-NOFP: la %r1, 0(%r1,%r15)
158546
 ; CHECK-NOFP: mviy 4096(%r1), 42
158546
 ; CHECK-NOFP: br %r14
158546
 ;
158546
 ; CHECK-FP-LABEL: f6:
158546
 ; CHECK-FP: llilh %r1, 8
158546
-; CHECK-FP: agr %r1, %r11
158546
+; CHECK-FP: la %r1, 0(%r1,%r11)
158546
 ; CHECK-FP: mviy 4096(%r1), 42
158546
 ; CHECK-FP: br %r14
158546
   %region1 = alloca [524104 x i8], align 8
158546
@@ -155,13 +155,13 @@ define void @f6() {
158546
 define void @f7() {
158546
 ; CHECK-NOFP-LABEL: f7:
158546
 ; CHECK-NOFP: llilh %r1, 23
158546
-; CHECK-NOFP: agr %r1, %r15
158546
+; CHECK-NOFP: la %r1, 0(%r1,%r15)
158546
 ; CHECK-NOFP: mviy 65535(%r1), 42
158546
 ; CHECK-NOFP: br %r14
158546
 ;
158546
 ; CHECK-FP-LABEL: f7:
158546
 ; CHECK-FP: llilh %r1, 23
158546
-; CHECK-FP: agr %r1, %r11
158546
+; CHECK-FP: la %r1, 0(%r1,%r11)
158546
 ; CHECK-FP: mviy 65535(%r1), 42
158546
 ; CHECK-FP: br %r14
158546
   %region1 = alloca [1048400 x i8], align 8
158546
@@ -178,13 +178,13 @@ define void @f7() {
158546
 define void @f8() {
158546
 ; CHECK-NOFP-LABEL: f8:
158546
 ; CHECK-NOFP: llilh %r1, 24
158546
-; CHECK-NOFP: agr %r1, %r15
158546
+; CHECK-NOFP: la %r1, 0(%r1,%r15)
158546
 ; CHECK-NOFP: mvi 7(%r1), 42
158546
 ; CHECK-NOFP: br %r14
158546
 ;
158546
 ; CHECK-FP-LABEL: f8:
158546
 ; CHECK-FP: llilh %r1, 24
158546
-; CHECK-FP: agr %r1, %r11
158546
+; CHECK-FP: la %r1, 0(%r1,%r11)
158546
 ; CHECK-FP: mvi 7(%r1), 42
158546
 ; CHECK-FP: br %r14
158546
   %region1 = alloca [1048408 x i8], align 8
158546
@@ -233,7 +233,7 @@ define void @f10(i32 *%vptr) {
158546
 ; CHECK-NOFP-LABEL: f10:
158546
 ; CHECK-NOFP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r15)
158546
 ; CHECK-NOFP: llilh [[REGISTER]], 8
158546
-; CHECK-NOFP: agr [[REGISTER]], %r15
158546
+; CHECK-NOFP: la [[REGISTER]], 0([[REGISTER]],%r15)
158546
 ; CHECK-NOFP: mvi 0([[REGISTER]]), 42
158546
 ; CHECK-NOFP: lg [[REGISTER]], [[OFFSET]](%r15)
158546
 ; CHECK-NOFP: br %r14
158546
@@ -241,7 +241,7 @@ define void @f10(i32 *%vptr) {
158546
 ; CHECK-FP-LABEL: f10:
158546
 ; CHECK-FP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r11)
158546
 ; CHECK-FP: llilh [[REGISTER]], 8
158546
-; CHECK-FP: agr [[REGISTER]], %r11
158546
+; CHECK-FP: la [[REGISTER]], 0([[REGISTER]],%r11)
158546
 ; CHECK-FP: mvi 0([[REGISTER]]), 42
158546
 ; CHECK-FP: lg [[REGISTER]], [[OFFSET]](%r11)
158546
 ; CHECK-FP: br %r14
158546
@@ -273,7 +273,7 @@ define void @f11(i32 *%vptr) {
158546
 ; CHECK-NOFP: stmg %r6, %r15,
158546
 ; CHECK-NOFP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r15)
158546
 ; CHECK-NOFP: llilh [[REGISTER]], 8
158546
-; CHECK-NOFP: agr [[REGISTER]], %r15
158546
+; CHECK-NOFP: la [[REGISTER]], 0([[REGISTER]],%r15)
158546
 ; CHECK-NOFP: mvi 0([[REGISTER]]), 42
158546
 ; CHECK-NOFP: lg [[REGISTER]], [[OFFSET]](%r15)
158546
 ; CHECK-NOFP: lmg %r6, %r15,
158546
diff --git a/llvm/test/CodeGen/SystemZ/frame-16.ll b/llvm/test/CodeGen/SystemZ/frame-16.ll
158546
index ae8a041ae110..a95c58207afb 100644
158546
--- a/llvm/test/CodeGen/SystemZ/frame-16.ll
158546
+++ b/llvm/test/CodeGen/SystemZ/frame-16.ll
158546
@@ -311,13 +311,13 @@ define void @f11(i32 *%vptr, i8 %byte) {
158546
 define void @f12(i8 %byte, i64 %index) {
158546
 ; CHECK-NOFP-LABEL: f12:
158546
 ; CHECK-NOFP: llilh %r1, 8
158546
-; CHECK-NOFP: agr %r1, %r15
158546
+; CHECK-NOFP: la %r1, 0(%r1,%r15)
158546
 ; CHECK-NOFP: stc %r2, 0(%r3,%r1)
158546
 ; CHECK-NOFP: br %r14
158546
 ;
158546
 ; CHECK-FP-LABEL: f12:
158546
 ; CHECK-FP: llilh %r1, 8
158546
-; CHECK-FP: agr %r1, %r11
158546
+; CHECK-FP: la %r1, 0(%r1,%r11)
158546
 ; CHECK-FP: stc %r2, 0(%r3,%r1)
158546
 ; CHECK-FP: br %r14
158546
   %region1 = alloca [524104 x i8], align 8
158546
-- 
158546
2.26.2
158546