[PATCH] D84218: [PowerPC] Fix wrong codegen when stack pointer has to realign in prologue

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 23:35:40 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8912252252c8: [PowerPC] Fix wrong codegen when stack pointer has to realign in prologue (authored by lkail).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84218/new/

https://reviews.llvm.org/D84218

Files:
  llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
  llvm/test/CodeGen/PowerPC/pr46759.ll


Index: llvm/test/CodeGen/PowerPC/pr46759.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/pr46759.ll
+++ llvm/test/CodeGen/PowerPC/pr46759.ll
@@ -12,7 +12,7 @@
 ; CHECK-LE-NEXT:    mr r12, r1
 ; CHECK-LE-NEXT:    .cfi_def_cfa r12, 0
 ; CHECK-LE-NEXT:    clrldi r0, r12, 53
-; CHECK-LE-NEXT:    stdux r12, r1, r0
+; CHECK-LE-NEXT:    subc r1, r1, r0
 ; CHECK-LE-NEXT:    stdu r12, -2048(r1)
 ; CHECK-LE-NEXT:    stdu r12, -4096(r1)
 ; CHECK-LE-NEXT:    .cfi_def_cfa_register r1
Index: llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
+++ llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
@@ -1466,11 +1466,10 @@
           .addImm(0)
           .addImm(32 - Log2(MaxAlign))
           .addImm(31);
-    BuildMI(PrologMBB, {MI}, DL, TII.get(isPPC64 ? PPC::STDUX : PPC::STWUX),
+    BuildMI(PrologMBB, {MI}, DL, TII.get(isPPC64 ? PPC::SUBFC8 : PPC::SUBFC),
             SPReg)
-        .addReg(FPReg)
-        .addReg(SPReg)
-        .addReg(ScratchReg);
+        .addReg(ScratchReg)
+        .addReg(SPReg);
   }
   // Probe residual part.
   if (NegResidualSize) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84218.279710.patch
Type: text/x-patch
Size: 1224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200722/184cc8de/attachment.bin>


More information about the llvm-commits mailing list