// Although a conservatively allocatable node can be allocated to a register,
// spilling it may provide a lower cost solution. Assert here that spilling
// is done by choice, not because there were no register available.
- if (G.getNodeMetadata(NId).isConservativelyAllocatable())
+ if (G.getNodeMetadata(NId).wasConservativelyAllocatable())
assert(hasRegisterOptions(v) && "A conservatively allocatable node "
"must have available register options");
NodeMetadata()
: RS(Unprocessed), NumOpts(0), DeniedOpts(0), OptUnsafeEdges(nullptr),
- VReg(0) {}
+ VReg(0), everConservativelyAllocatable(false) {}
// FIXME: Re-implementing default behavior to work around MSVC. Remove once
// MSVC synthesizes move constructors properly.
void setReductionState(ReductionState RS) {
assert(RS >= this->RS && "A node's reduction state can not be downgraded");
this->RS = RS;
+
+ // Remember this state to assert later that a non-infinite register
+ // option was available.
+ if (RS == ConservativelyAllocatable)
+ everConservativelyAllocatable = true;
}
+
void handleAddEdge(const MatrixMetadata& MD, bool Transpose) {
DeniedOpts += Transpose ? MD.getWorstRow() : MD.getWorstCol();
const bool* UnsafeOpts =
&OptUnsafeEdges[NumOpts]);
}
+ bool wasConservativelyAllocatable() const {
+ return everConservativelyAllocatable;
+ }
+
private:
ReductionState RS;
unsigned NumOpts;
std::unique_ptr<unsigned[]> OptUnsafeEdges;
unsigned VReg;
GraphMetadata::AllowedRegVecRef AllowedRegs;
+ bool everConservativelyAllocatable;
};
class RegAllocSolverImpl {