Re: [Nouveau] [PATCH] nv50/ra: Only increment DefValue counter if we are going to spill

2017-08-19 Thread Ilia Mirkin
On Sat, Aug 19, 2017 at 12:50 PM, Tobias Klausmann
 wrote:
> This is in preparation of an upcoming patch changing how we keep track of the
> defs.
>
> Signed-off-by: Tobias Klausmann 
> ---
>  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& lst)
>// multiple destinations that all need to be spilled (like OP_SPLIT).
>unordered_set 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(mem) : new_LValue(func, FILE_GPR);
>   Value *tmp = NULL;
> @@ -1787,13 +1786,13 @@ SpillCodeInserter::run(const std::list& 
> 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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [PATCH] nv50/ra: Only increment DefValue counter if we are going to spill

2017-08-19 Thread Tobias Klausmann
This is in preparation of an upcoming patch changing how we keep track of the
defs.

Signed-off-by: Tobias Klausmann 
---
 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& lst)
   // multiple destinations that all need to be spilled (like OP_SPLIT).
   unordered_set 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(mem) : new_LValue(func, FILE_GPR);
  Value *tmp = NULL;
@@ -1787,13 +1786,13 @@ SpillCodeInserter::run(const std::list& 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

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau