Subzero: Implement InstList in terms of llvm::ilist<> .
Use LLVM's intrusive list ADT template to implement instruction lists. This embeds prev/next pointers into the instruction, and as such, iterators essentially double as instruction pointers. This means stripping off one level of indirection when dereferencing, and also the range-based for loop can't be used.
The performance difference in translation time seems to be 1-2%.
I tried to also do this for the much less used PhiList and AssignList, but ran into SFINAE problems.
BUG= none
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/709533002
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index 350605b..5661ad9 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -62,7 +62,7 @@
}
void LoweringContext::skipDeleted(InstList::iterator &I) const {
- while (I != End && (*I)->isDeleted())
+ while (I != End && I->isDeleted())
++I;
}
@@ -116,7 +116,7 @@
bool TargetLowering::shouldDoNopInsertion() const { return DoNopInsertion; }
void TargetLowering::doNopInsertion() {
- Inst *I = *Context.getCur();
+ Inst *I = Context.getCur();
bool ShouldSkip = llvm::isa<InstFakeUse>(I) || llvm::isa<InstFakeDef>(I) ||
llvm::isa<InstFakeKill>(I) || I->isRedundantAssign() ||
I->isDeleted();
@@ -141,7 +141,7 @@
// instructions it consumes.
void TargetLowering::lower() {
assert(!Context.atEnd());
- Inst *Inst = *Context.getCur();
+ Inst *Inst = Context.getCur();
// Mark the current instruction as deleted before lowering,
// otherwise the Dest variable will likely get marked as non-SSA.
// See Variable::setDefinition().