Subzero: Minor refactoring/additions in preparation for phi edge splitting.
The only functional change (though not actually visible at this point) is that redundant assignment elimination is moved into a separate pass.
BUG= none
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/672393003
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index bcc6290..b18999f 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -54,6 +54,7 @@
void LoweringContext::insert(Inst *Inst) {
getNode()->getInsts().insert(Next, Inst);
+ LastInserted = Inst;
}
void LoweringContext::skipDeleted(InstList::iterator &I) const {
@@ -68,17 +69,9 @@
}
}
-void LoweringContext::advanceBackward(InstList::iterator &I) const {
- assert(I != Begin);
- do {
- --I;
- } while (I != Begin && (*I)->isDeleted());
-}
-
Inst *LoweringContext::getLastInserted() const {
- InstList::iterator Cursor = Next;
- advanceBackward(Cursor);
- return *Cursor;
+ assert(LastInserted);
+ return LastInserted;
}
TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) {