svn commit: r319082 - stable/11/contrib/llvm/lib/Target/PowerPC

Dimitry Andric dim at FreeBSD.org
Sun May 28 18:18:03 UTC 2017


Author: dim
Date: Sun May 28 18:18:01 2017
New Revision: 319082
URL: https://svnweb.freebsd.org/changeset/base/319082

Log:
  MFC r318906:
  
  Pull in r303257 from upstream llvm trunk (by Krzysztof Parzyszek)
  
    [PPC] Properly update register save area offsets
  
    The variables MinGPR/MinG8R were not updated properly when resetting the
    offsets, which in the included testcase lead to saving the CR register
    in the same location as R30.
  
    This fixes another issue reported in PR26519.
  
    Differential Revision: https://reviews.llvm.org/D33017
  
  Reported by:	Mark Millard
  PR:		206990

Modified:
  stable/11/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
==============================================================================
--- stable/11/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp	Sun May 28 18:13:44 2017	(r319081)
+++ stable/11/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp	Sun May 28 18:18:01 2017	(r319082)
@@ -1775,32 +1775,37 @@ void PPCFrameLowering::processFunctionBe
   // Check whether the frame pointer register is allocated. If so, make sure it
   // is spilled to the correct offset.
   if (needsFP(MF)) {
-    HasGPSaveArea = true;
-
     int FI = PFI->getFramePointerSaveIndex();
     assert(FI && "No Frame Pointer Save Slot!");
-
     MFI.setObjectOffset(FI, LowerBound + MFI.getObjectOffset(FI));
+    // FP is R31/X31, so no need to update MinGPR/MinG8R.
+    HasGPSaveArea = true;
   }
 
   if (PFI->usesPICBase()) {
-    HasGPSaveArea = true;
-
     int FI = PFI->getPICBasePointerSaveIndex();
     assert(FI && "No PIC Base Pointer Save Slot!");
-
     MFI.setObjectOffset(FI, LowerBound + MFI.getObjectOffset(FI));
+
+    MinGPR = std::min<unsigned>(MinGPR, PPC::R30);
+    HasGPSaveArea = true;
   }
 
   const PPCRegisterInfo *RegInfo =
       static_cast<const PPCRegisterInfo *>(Subtarget.getRegisterInfo());
   if (RegInfo->hasBasePointer(MF)) {
-    HasGPSaveArea = true;
-
     int FI = PFI->getBasePointerSaveIndex();
     assert(FI && "No Base Pointer Save Slot!");
-
     MFI.setObjectOffset(FI, LowerBound + MFI.getObjectOffset(FI));
+
+    unsigned BP = RegInfo->getBaseRegister(MF);
+    if (PPC::G8RCRegClass.contains(BP)) {
+      MinG8R = std::min<unsigned>(MinG8R, BP);
+      HasG8SaveArea = true;
+    } else if (PPC::GPRCRegClass.contains(BP)) {
+      MinGPR = std::min<unsigned>(MinGPR, BP);
+      HasGPSaveArea = true;
+    }
   }
 
   // General register save area starts right below the Floating-point


More information about the svn-src-stable mailing list