nir: Automatically update SSA if uses
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 1 Dec 2014 22:39:10 +0000 (14:39 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 15 Jan 2015 15:19:02 +0000 (07:19 -0800)
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir.c

index 281683a542da350565cc8c0c2931946d7ffa9600..b6bd78d05e669128e5c5e9c43a4abce8bffefebf 100644 (file)
@@ -1010,13 +1010,12 @@ update_if_uses(nir_cf_node *node)
       return;
 
    nir_if *if_stmt = nir_cf_node_as_if(node);
-   if (if_stmt->condition.is_ssa)
-      return;
 
-   nir_register *reg = if_stmt->condition.reg.reg;
-   assert(reg != NULL);
+   struct set *if_uses_set = if_stmt->condition.is_ssa ?
+                             if_stmt->condition.ssa->if_uses :
+                             if_stmt->condition.reg.reg->uses;
 
-   _mesa_set_add(reg->if_uses, _mesa_hash_pointer(if_stmt), if_stmt);
+   _mesa_set_add(if_uses_set, _mesa_hash_pointer(if_stmt), if_stmt);
 }
 
 void