Mesa (master): nvc0/ir: safen up lowering logic against overwriting reused values

Ilia Mirkin imirkin at kemper.freedesktop.org
Sun Jan 7 16:43:44 UTC 2018


Module: Mesa
Branch: master
Commit: 7f92c8ee3709b7e229321636ee15b6b7571fe3ea
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f92c8ee3709b7e229321636ee15b6b7571fe3ea

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Sat Apr  8 00:05:18 2017 -0400

nvc0/ir: safen up lowering logic against overwriting reused values

I'm fairly sure both of the changed sites are OK as-is, but they're
fragile, so this is just safening them up. Since this is happening
pre-ssa, we don't want to be overwriting values that may potentially get
used later on.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
index 51f6fae2c1..8a864079ce 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
@@ -1046,9 +1046,11 @@ NVC0LoweringPass::handleTEX(TexInstruction *i)
             if (chipset >= NVISA_GM107_CHIPSET)
                s += dim;
             if (i->tex.target.isArray()) {
-               bld.mkOp3(OP_INSBF, TYPE_U32, i->getSrc(s),
+               Value *offset = bld.getScratch();
+               bld.mkOp3(OP_INSBF, TYPE_U32, offset,
                          bld.loadImm(NULL, imm), bld.mkImm(0xc10),
                          i->getSrc(s));
+               i->setSrc(s, offset);
             } else {
                i->moveSources(s, 1);
                i->setSrc(s, bld.loadImm(NULL, imm << 16));
@@ -2457,7 +2459,7 @@ NVC0LoweringPass::handleLDST(Instruction *i)
             // Clamp the UBO index when an indirect access is used to avoid
             // loading information from the wrong place in the driver cb.
             // TODO - synchronize the max with the driver.
-            ind = bld.mkOp2v(OP_MIN, TYPE_U32, ind,
+            ind = bld.mkOp2v(OP_MIN, TYPE_U32, bld.getSSA(),
                              bld.mkOp2v(OP_ADD, TYPE_U32, bld.getSSA(),
                                         ind, bld.loadImm(NULL, fileIndex)),
                              bld.loadImm(NULL, 13));




More information about the mesa-commit mailing list