Rewrite logic to figure out whether LR needs to
be saved/restored in the prolog/epilog.  We need
to do this iff something in the function stores
into it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58116 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PowerPC/PPCMachineFunctionInfo.h b/lib/Target/PowerPC/PPCMachineFunctionInfo.h
index 230ea0b..42883d7 100644
--- a/lib/Target/PowerPC/PPCMachineFunctionInfo.h
+++ b/lib/Target/PowerPC/PPCMachineFunctionInfo.h
@@ -31,9 +31,10 @@
   ///
   int ReturnAddrSaveIndex;
 
-  /// UsesLR - Indicates whether LR is used in the current function.  This is
-  /// only valid after the initial scan of the function by PEI.
-  bool UsesLR;
+  /// MustSaveLR - Indicates whether LR is defined (or clobbered) in the current
+  /// function.  This is only valid after the initial scan of the function by
+  /// PEI.
+  bool MustSaveLR;
 
   /// SpillsCR - Indicates whether CR is spilled in the current function.
   bool SpillsCR;
@@ -79,12 +80,13 @@
   int getTailCallSPDelta() const { return TailCallSPDelta; }
   void setTailCallSPDelta(int size) { TailCallSPDelta = size; }
 
-  /// UsesLR - This is set when the prolog/epilog inserter does its initial scan
-  /// of the function, it is true if the LR/LR8 register is ever explicitly
-  /// accessed/clobbered in the machine function (e.g. by calls and movpctolr,
-  /// which is used in PIC generation).
-  void setUsesLR(bool U) { UsesLR = U; }
-  bool usesLR() const    { return UsesLR; }
+  /// MustSaveLR - This is set when the prolog/epilog inserter does its initial
+  /// scan of the function. It is true if the LR/LR8 register is ever explicitly
+  /// defined/clobbered in the machine function (e.g. by calls and movpctolr,
+  /// which is used in PIC generation), or if the LR stack slot is explicitly
+  /// referenced by builtin_return_address.
+  void setMustSaveLR(bool U) { MustSaveLR = U; }
+  bool mustSaveLR() const    { return MustSaveLR; }
 
   void setSpillsCR()       { SpillsCR = true; }
   bool isCRSpilled() const { return SpillsCR; }