summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2019-01-15 12:27:09 -0800
committerIan Romanick <ian.d.romanick@intel.com>2019-01-15 12:27:36 -0800
commit14cc1bbb8014989a42949642771925aa5a9311e8 (patch)
tree7333979fbcc71e0b20a156ab939b333059afb3b6
parent73a13fad99b4171cc38c2825482eb0957573c1c3 (diff)
fixup! WIP: nir: Copy propagate from bcsel source to phi nodeecd3c4bb5556b452c51941
-rw-r--r--src/compiler/nir/nir_opt_if.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c
index 434ad7ae08a..b541aac952f 100644
--- a/src/compiler/nir/nir_opt_if.c
+++ b/src/compiler/nir/nir_opt_if.c
@@ -398,6 +398,8 @@ opt_simpify_bcsel_of_phi(nir_loop *loop)
* 4. The phi node source for the entry block must be the same as the bcsel
* source that would be selected from the entry block.
*
+ * 5. The sources of the bcsel cannot have any source modifiers.
+ *
* If these conditions are met, the use of the bcsel in the phi node source is
* replaced with the bcsel source selected by the constant from the loop
* continue.
@@ -449,6 +451,12 @@ opt_simpify_phi_of_bcsel(nir_loop *loop)
if (bcsel == NULL)
continue;
+ /* The bcsel cannot have source modifiers on any of the sources. */
+ if (bcsel->src[0].negate || bcsel->src[0].abs ||
+ bcsel->src[1].negate || bcsel->src[1].abs ||
+ bcsel->src[2].negate || bcsel->src[2].abs)
+ continue;
+
nir_phi_instr *const cond_phi =
nir_instr_as_phi(bcsel->src[0].src.ssa->parent_instr);