Commit 5d2fa0cf by Jim Stichnoth

Subzero: Fix a bug in postLower().

In -O2 mode, postLower() is supposed to iterate over just the instructions that were most recently added. Instead, it was iterating all the way to the end of the block, also post-lowering high-level ICE instructions that hadn't yet been lowered. This was basically harmless, given that the spec2k asm code is identical after this patch, but it improves performance. BUG= none R=jvoung@chromium.org Review URL: https://codereview.chromium.org/721333004
parent 9d801a01
......@@ -56,10 +56,8 @@ public:
CfgNode *getNode() const { return Node; }
bool atEnd() const { return Cur == End; }
InstList::iterator getCur() const { return Cur; }
InstList::iterator getNext() const { return Next; }
InstList::iterator getEnd() const { return End; }
// Adaptor to enable range-based for loops.
InstList::iterator begin() const { return getCur(); }
InstList::iterator end() const { return getEnd(); }
void insert(Inst *Inst);
Inst *getLastInserted() const;
void advanceCur() { Cur = Next; }
......
......@@ -4299,7 +4299,7 @@ void TargetX8632::lowerPhiAssignments(CfgNode *Node,
}
// Add the terminator branch instruction to the end.
Context.setInsertPoint(Context.end());
Context.setInsertPoint(Context.getEnd());
_br(Succ);
}
......@@ -4509,7 +4509,7 @@ void TargetX8632::postLower() {
return;
// Find two-address non-SSA instructions where Dest==Src0, and set
// the DestNonKillable flag to keep liveness analysis consistent.
for (auto Inst = Context.begin(), E = Context.end(); Inst != E; ++Inst) {
for (auto Inst = Context.getCur(), E = Context.getNext(); Inst != E; ++Inst) {
if (Inst->isDeleted())
continue;
if (Variable *Dest = Inst->getDest()) {
......
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