nv50/ir: run DCE backwards
authorKarol Herbst <nouveau@karolherbst.de>
Wed, 27 Jan 2016 17:25:07 +0000 (18:25 +0100)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 28 Jan 2016 20:34:29 +0000 (15:34 -0500)
Reduces calls up to 50%

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp

index b2c9fdfc7a463ff6c9e1168434c8a9e4d2c72b5c..bda9c7d0c52310f1c720e78380a6779639ffc250 100644 (file)
@@ -3187,10 +3187,10 @@ DeadCodeElim::buryAll(Program *prog)
 bool
 DeadCodeElim::visit(BasicBlock *bb)
 {
-   Instruction *next;
+   Instruction *prev;
 
-   for (Instruction *i = bb->getFirst(); i; i = next) {
-      next = i->next;
+   for (Instruction *i = bb->getExit(); i; i = prev) {
+      prev = i->prev;
       if (i->isDead()) {
          ++deadCount;
          delete_Instruction(prog, i);