[PowerPC] Remove wild call to RegScavenger::initRegState().
authorAlexey Samsonov <vonosmas@gmail.com>
Wed, 2 Dec 2015 21:25:28 +0000 (21:25 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Wed, 2 Dec 2015 21:25:28 +0000 (21:25 +0000)
This call should in fact be made by RegScavenger::enterBasicBlock()
called below. The first call does nothing except for triggering UB,
indicated by UBSan (passing nullptr to memset()).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254548 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/RegisterScavenging.h
lib/Target/PowerPC/PPCFrameLowering.cpp

index 6517a58f5c07b915798989431b04db160a3c9816..122c78534253ebf0f603eb2ebee2c83f4cfde796 100644 (file)
@@ -74,10 +74,6 @@ public:
   /// Start tracking liveness from the begin of the specific basic block.
   void enterBasicBlock(MachineBasicBlock *mbb);
 
-  /// Allow resetting register state info for multiple
-  /// passes over/within the same function.
-  void initRegState();
-
   /// Move the internal MBB iterator and update register states.
   void forward();
 
@@ -180,6 +176,9 @@ private:
                            unsigned InstrLimit,
                            MachineBasicBlock::iterator &UseMI);
 
+  /// Allow resetting register state info for multiple
+  /// passes over/within the same function.
+  void initRegState();
 };
 
 } // End llvm namespace
index 5a151eb6ab25f21a01e7d479d2804a6913892147..174deb88bc5c3324474b1f7204a77fcdeb0cc51f 100644 (file)
@@ -569,8 +569,7 @@ bool PPCFrameLowering::findScratchRegister(MachineBasicBlock *MBB,
   if ((UseAtEnd && MBB->isReturnBlock()) ||
       (!UseAtEnd && (&MBB->getParent()->front() == MBB)))
     return true;
-    
-  RS.initRegState();
+
   RS.enterBasicBlock(MBB);
 
   if (UseAtEnd && !MBB->empty()) {