nir: Convert a bcsel with only phi node sources to a phi node
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 18 Jan 2019 01:53:40 +0000 (17:53 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 8 Feb 2019 18:37:06 +0000 (10:37 -0800)
commitb031c643491a92a5574c7a4bd659df33f2d89bb6
tree21c0c2beaa974b71e54922d041905be4d3df0623
parent0881e90c09965818b02e359474a6f7446b41d647
nir: Convert a bcsel with only phi node sources to a phi node

v2: Remove the original ALU instruciton after all of its readers are
modified to read the new ALU instruction.

v3: Fix an issue where a bcsel that may not be executed on a loop
iteration due to a break statement is converted to a phi (and therefore
incorrectly "executed").  Noticed by Tim.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109216
Fixes: 8fb8ebfbb05 ("intel/compiler: More peephole select")
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/nir/nir_opt_if.c