Tobias Klausmann
2017-Aug-19  16:50 UTC
[Nouveau] [PATCH] nv50/ra: Only increment DefValue counter if we are going to spill
This is in preparation of an upcoming patch changing how we keep track of the
defs.
Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
index e4f38c8e46..5034f8f989 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
@@ -1750,8 +1750,7 @@ SpillCodeInserter::run(const
std::list<ValuePair>& lst)
       // multiple destinations that all need to be spilled (like OP_SPLIT).
       unordered_set<Instruction *> to_del;
 
-      for (Value::DefIterator d = lval->defs.begin(); d !=
lval->defs.end();
-           ++d) {
+      for (Value::DefIterator d = lval->defs.begin(); d !=
lval->defs.end();) {
          Value *slot = mem ?
             static_cast<Value *>(mem) : new_LValue(func, FILE_GPR);
          Value *tmp = NULL;
@@ -1787,13 +1786,13 @@ SpillCodeInserter::run(const
std::list<ValuePair>& lst)
          assert(defi);
          if (defi->isPseudo()) {
             d = lval->defs.erase(d);
-            --d;
             if (slot->reg.file == FILE_MEMORY_LOCAL)
                to_del.insert(defi);
             else
                defi->setDef(0, slot);
          } else {
             spill(defi, slot, dval);
+            d++;
          }
       }
 
-- 
2.14.0
Ilia Mirkin
2017-Aug-19  16:55 UTC
[Nouveau] [PATCH] nv50/ra: Only increment DefValue counter if we are going to spill
On Sat, Aug 19, 2017 at 12:50 PM, Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de> wrote:> This is in preparation of an upcoming patch changing how we keep track of the > defs. > > Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de> > --- > src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp > index e4f38c8e46..5034f8f989 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp > @@ -1750,8 +1750,7 @@ SpillCodeInserter::run(const std::list<ValuePair>& lst) > // multiple destinations that all need to be spilled (like OP_SPLIT). > unordered_set<Instruction *> to_del; > > - for (Value::DefIterator d = lval->defs.begin(); d != lval->defs.end(); > - ++d) { > + for (Value::DefIterator d = lval->defs.begin(); d != lval->defs.end();) { > Value *slot = mem ? > static_cast<Value *>(mem) : new_LValue(func, FILE_GPR); > Value *tmp = NULL; > @@ -1787,13 +1786,13 @@ SpillCodeInserter::run(const std::list<ValuePair>& lst) > assert(defi); > if (defi->isPseudo()) { > d = lval->defs.erase(d); > - --d; > if (slot->reg.file == FILE_MEMORY_LOCAL) > to_del.insert(defi); > else > defi->setDef(0, slot); > } else { > spill(defi, slot, dval); > + d++;++d; I have vague recollections of this being preferred because of some silly C++ difference in how the pre- and post-fix operators work.> } > } > > -- > 2.14.0 > > _______________________________________________ > Nouveau mailing list > Nouveau at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau
Seemingly Similar Threads
- [PATCH] nv50/ir: avoid deleting pseudo instructions too early
- [PATCH RESEND] nv50/ir: use unordered_set instead of list to keep track of var defs
- [PATCH] nv50/ir: use unordered_set instead of list to keep track of var defs
- [Bug 79462] New: [NVC0/Codegen] Shader compilation falis in spill logic
- [PATCH] nv50/ir: use unordered_set instead of list to keep our instructions in uses