diff options
-rw-r--r-- | src/gallium/drivers/nv50/codegen/nv50_ir.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.h b/src/gallium/drivers/nv50/codegen/nv50_ir.h index b582a468b31..93e3008cf0d 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir.h +++ b/src/gallium/drivers/nv50/codegen/nv50_ir.h @@ -616,6 +616,7 @@ public: bool setPredicate(CondCode ccode, Value *); inline Value *getPredicate() const; bool writesPredicate() const; + inline bool isPredicated() const { return predSrc >= 0; } inline void setFlagsSrc(int s, Value *); inline void setFlagsDef(int d, Value *); diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp index c2c33e20bf1..5f974436e94 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp @@ -2009,6 +2009,8 @@ GlobalCSE::visit(BasicBlock *bb) Instruction *phi, *next, *ik; int s; + // TODO: maybe do this with OP_UNION, too + for (phi = bb->getPhi(); phi && phi->op == OP_PHI; phi = next) { next = phi->next; if (phi->getSrc(0)->refCount() > 1) @@ -2040,8 +2042,14 @@ bool LocalCSE::tryReplace(Instruction **ptr, Instruction *i) { Instruction *old = *ptr; + + // TODO: maybe relax this later (causes trouble with OP_UNION) + if (i->isPredicated()) + return false; + if (!old->isResultEqual(i)) return false; + for (int d = 0; old->defExists(d); ++d) old->def(d).replace(i->getDef(d), false); delete_Instruction(prog, old); @@ -2241,6 +2249,7 @@ Program::optimizeSSA(int level) RUN_PASS(2, MemoryOpt, run); RUN_PASS(2, LocalCSE, run); RUN_PASS(0, DeadCodeElim, buryAll); + return true; } |