[llvm-branch-commits] [llvm-branch] r304150 - Merging r302183:

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon May 29 04:56:30 PDT 2017


Author: tstellar
Date: Mon May 29 06:56:29 2017
New Revision: 304150

URL: http://llvm.org/viewvc/llvm-project?rev=304150&view=rev
Log:
Merging r302183:

------------------------------------------------------------------------
r302183 | kparzysz | 2017-05-04 15:14:54 -0400 (Thu, 04 May 2017) | 7 lines

[PPC] When restoring R30 (PIC base pointer), mark it as <def>

This happened on the PPC32/SVR4 path and was discovered when building
FreeBSD on PPC32. It was a typo-class error in the frame lowering code.

This fixes PR26519.

------------------------------------------------------------------------

Added:
    llvm/branches/release_40/test/CodeGen/PowerPC/restore-r30.ll
Modified:
    llvm/branches/release_40/lib/Target/PowerPC/PPCFrameLowering.cpp

Modified: llvm/branches/release_40/lib/Target/PowerPC/PPCFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_40/lib/Target/PowerPC/PPCFrameLowering.cpp?rev=304150&r1=304149&r2=304150&view=diff
==============================================================================
--- llvm/branches/release_40/lib/Target/PowerPC/PPCFrameLowering.cpp (original)
+++ llvm/branches/release_40/lib/Target/PowerPC/PPCFrameLowering.cpp Mon May 29 06:56:29 2017
@@ -1467,8 +1467,7 @@ void PPCFrameLowering::emitEpilogue(Mach
   }
 
   if (FI->usesPICBase())
-    BuildMI(MBB, MBBI, dl, LoadInst)
-      .addReg(PPC::R30)
+    BuildMI(MBB, MBBI, dl, LoadInst, PPC::R30)
       .addImm(PBPOffset)
       .addReg(RBReg);
 

Added: llvm/branches/release_40/test/CodeGen/PowerPC/restore-r30.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_40/test/CodeGen/PowerPC/restore-r30.ll?rev=304150&view=auto
==============================================================================
--- llvm/branches/release_40/test/CodeGen/PowerPC/restore-r30.ll (added)
+++ llvm/branches/release_40/test/CodeGen/PowerPC/restore-r30.ll Mon May 29 06:56:29 2017
@@ -0,0 +1,30 @@
+; RUN: llc -march=ppc32 -relocation-model=pic < %s | FileCheck %s
+
+; The load restoring r30 at the end of the function was placed out of order
+; relative to its uses as the PIC base pointer.
+; This was because the r30 operand was not marked as "def" which allowed
+; the post-RA scheduler to move it over other uses of r30.
+
+; CHECK-LABEL: fred
+; CHECK:       lwz 30, 24(1)
+; R30 should not appear in an instruction after it's been restored.
+; CHECK-NOT:   30,
+
+target datalayout = "E-m:e-p:32:32-i64:64-n32"
+target triple = "powerpc"
+
+define double @fred(i64 %a) #0 {
+entry:
+  %0 = lshr i64 %a, 32
+  %conv = trunc i64 %0 to i32
+  %conv1 = sitofp i32 %conv to double
+  %mul = fmul double %conv1, 0x41F0000000000000
+  %and = and i64 %a, 4294967295
+  %or = or i64 %and, 4841369599423283200
+  %sub = fadd double %mul, 0xC330000000000000
+  %1 = bitcast i64 %or to double
+  %add = fadd double %sub, %1
+  ret double %add
+}
+
+attributes #0 = { norecurse nounwind readnone "target-cpu"="ppc" "use-soft-float"="false" }




More information about the llvm-branch-commits mailing list