[Mesa-dev] [PATCH 67/95] i965/vec4: prevent copy-propagation from values with a different type size

Iago Toral Quiroga itoral at igalia.com
Tue Jul 19 10:41:04 UTC 2016


Because the meaning of the swizzles and writemasks involved is different,
so replacing the source would lead to different semantics.
---
 src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index 29a62c1..6f52eec 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -322,6 +322,13 @@ try_copy_propagate(const struct brw_device_info *devinfo,
        value.file != ATTR)
       return false;
 
+   /* If the type of the copy value is different from the type of the
+    * instruction then the swizzles and writemasks involved don't have the same
+    * meaning and simply replacing the source would produce different semantics.
+    */
+   if (type_sz(value.type) != type_sz(inst->src[arg].type))
+      return false;
+
    if (devinfo->gen >= 8 && (value.negate || value.abs) &&
        is_logic_op(inst->opcode)) {
       return false;
-- 
2.7.4



More information about the mesa-dev mailing list