Revert "[PBQP] Unique-ptrify some PBQP Metadata structures. No functional change." (r220642)

It broke the Windows build:

  [1/19] Building CXX object lib\CodeGen\CMakeFiles\LLVMCodeGen.dir\RegAllocPBQP.cpp.obj
  C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\llvm\include\llvm/CodeGen/RegAllocPBQP.h(132) : error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_Ty>'

     with
     [
         _Ty=unsigned int []
     ]
     D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\memory(1600) : see declaration of 'std::unique_ptr<_Ty>::unique_ptr'
     with
     [
         _Ty=unsigned int []
     ]
     This diagnostic occurred in the compiler generated function 'llvm::PBQP::RegAlloc::NodeMetadata::NodeMetadata(const llvm::PBQP::RegAlloc::NodeMetadata &)'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220645 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Hans Wennborg
2014-10-26 19:50:13 +00:00
parent 82256c4019
commit 0846d688d1

View File

@@ -62,15 +62,20 @@ public:
delete[] ColCounts; delete[] ColCounts;
} }
~MatrixMetadata() {
delete[] UnsafeRows;
delete[] UnsafeCols;
}
unsigned getWorstRow() const { return WorstRow; } unsigned getWorstRow() const { return WorstRow; }
unsigned getWorstCol() const { return WorstCol; } unsigned getWorstCol() const { return WorstCol; }
const bool* getUnsafeRows() const { return UnsafeRows.get(); } const bool* getUnsafeRows() const { return UnsafeRows; }
const bool* getUnsafeCols() const { return UnsafeCols.get(); } const bool* getUnsafeCols() const { return UnsafeCols; }
private: private:
unsigned WorstRow, WorstCol; unsigned WorstRow, WorstCol;
std::unique_ptr<bool[]> UnsafeRows; bool* UnsafeRows;
std::unique_ptr<bool[]> UnsafeCols; bool* UnsafeCols;
}; };
class NodeMetadata { class NodeMetadata {
@@ -83,6 +88,7 @@ public:
NotProvablyAllocatable } ReductionState; NotProvablyAllocatable } ReductionState;
NodeMetadata() : RS(Unprocessed), DeniedOpts(0), OptUnsafeEdges(nullptr){} NodeMetadata() : RS(Unprocessed), DeniedOpts(0), OptUnsafeEdges(nullptr){}
~NodeMetadata() { delete[] OptUnsafeEdges; }
void setVReg(unsigned VReg) { this->VReg = VReg; } void setVReg(unsigned VReg) { this->VReg = VReg; }
unsigned getVReg() const { return VReg; } unsigned getVReg() const { return VReg; }
@@ -94,7 +100,7 @@ public:
void setup(const Vector& Costs) { void setup(const Vector& Costs) {
NumOpts = Costs.getLength() - 1; NumOpts = Costs.getLength() - 1;
OptUnsafeEdges = std::unique_ptr<unsigned[]>(new unsigned[NumOpts]()); OptUnsafeEdges = new unsigned[NumOpts]();
} }
ReductionState getReductionState() const { return RS; } ReductionState getReductionState() const { return RS; }
@@ -118,15 +124,15 @@ public:
bool isConservativelyAllocatable() const { bool isConservativelyAllocatable() const {
return (DeniedOpts < NumOpts) || return (DeniedOpts < NumOpts) ||
(std::find(&OptUnsafeEdges[0], &OptUnsafeEdges[NumOpts], 0) != (std::find(OptUnsafeEdges, OptUnsafeEdges + NumOpts, 0) !=
&OptUnsafeEdges[NumOpts]); OptUnsafeEdges + NumOpts);
} }
private: private:
ReductionState RS; ReductionState RS;
unsigned NumOpts; unsigned NumOpts;
unsigned DeniedOpts; unsigned DeniedOpts;
std::unique_ptr<unsigned[]> OptUnsafeEdges; unsigned* OptUnsafeEdges;
unsigned VReg; unsigned VReg;
OptionToRegMap OptionRegs; OptionToRegMap OptionRegs;
}; };