Commit 6b4e418f authored by Kevin Modzelewski's avatar Kevin Modzelewski

Turn vreg-reuse back on

A tricky side-effect I didn't think about is that
block-local vregs can now look "live" at the end of
their block.  When using names, there are no other uses/defs,
but if we reassign the vreg there can be.
parent b29380d9
......@@ -159,6 +159,12 @@ bool LivenessAnalysis::isLiveAtEnd(int vreg, CFGBlock* block) {
if (vreg < block->cfg->getVRegInfo().getNumOfUserVisibleVRegs())
return true;
// For block-local vregs, this query doesn't really make sense,
// since the vreg will be live but that's probably not what we care about.
// It's probably safe to return false, but let's just error for now.
if (block->cfg->getVRegInfo().isBlockLocalVReg(vreg))
return false;
if (block->successors.size() == 0)
return false;
......
......@@ -2755,7 +2755,6 @@ public:
auto it = sym_vreg_map.find(id);
if (sym_vreg_map.end() == it) {
ASSERT(next_vreg == sym_vreg_map.size(), "%d %d", next_vreg, sym_vreg_map.size());
sym_vreg_map[id] = next_vreg;
if (!REUSE_VREGS || step == UserVisible || step == CrossBlock) {
......@@ -2813,6 +2812,8 @@ void VRegInfo::assignVRegs(CFG* cfg, const ParamNames& param_names, ScopeInfo* s
assert(hasVRegsAssigned());
#if REUSE_VREGS
assert(vreg_sym_map.size() == num_vregs_cross_block);
#else
assert(vreg_sym_map.size() == num_vregs);
#endif
}
......
......@@ -135,9 +135,8 @@ public:
// Not all vregs correspond to a name; many are our compiler-generated variables.
bool vregHasName(int vreg) const { return vreg < num_vregs_cross_block; }
// XXX temporarily disable vreg reuse, since for the transition we want to make it very
// easy to convert between vregs and names.
#define REUSE_VREGS 0
// Testing flag to turn off the "vreg reuse" optimization.
#define REUSE_VREGS 1
InternedString getName(int vreg) const {
assert(hasVRegsAssigned());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment