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
diff --git a/src/IceTargetLowering.h b/src/IceTargetLowering.h
index 07d665f..da1d3f0 100644
--- a/src/IceTargetLowering.h
+++ b/src/IceTargetLowering.h
@@ -56,10 +56,8 @@
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; }
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index b96023e..937a15b 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -4299,7 +4299,7 @@
}
// Add the terminator branch instruction to the end.
- Context.setInsertPoint(Context.end());
+ Context.setInsertPoint(Context.getEnd());
_br(Succ);
}
@@ -4509,7 +4509,7 @@
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()) {