Re: [Mesa-dev] [PATCH 2/2] gallium: Replace u_simple_list.h with util/simple_list.h

2015-01-24 Thread Marek Olšák
Hi Eric,

They are not the same. Gallium has
68afbe89c72d085dcbbf2b264f0201ab73fe339e. If the change is applied to
the common version, you will have my Rb.

Marek

On Sat, Jan 24, 2015 at 12:37 AM, Eric Anholt  wrote:
> The code was exactly the same, except util/ has c++ guards and a struct
> simple_node declaration.
> ---
>
> For my NIR work, there were clashes between gallium's copy (from my driver)
> and Mesa's (from NIR)
>
>  src/gallium/auxiliary/Makefile.sources|   1 -
>  src/gallium/auxiliary/draw/draw_llvm.c|   2 +-
>  src/gallium/auxiliary/draw/draw_llvm.h|   2 +-
>  src/gallium/auxiliary/gallivm/lp_bld_init.c   |   2 +-
>  src/gallium/auxiliary/util/u_cache.c  |   2 +-
>  src/gallium/auxiliary/util/u_simple_list.h| 199 
> --
>  src/gallium/auxiliary/util/u_slab.c   |   2 +-
>  src/gallium/drivers/llvmpipe/lp_context.c |   2 +-
>  src/gallium/drivers/llvmpipe/lp_scene.c   |   2 +-
>  src/gallium/drivers/llvmpipe/lp_state_fs.c|   2 +-
>  src/gallium/drivers/llvmpipe/lp_state_setup.c |   2 +-
>  src/gallium/drivers/llvmpipe/lp_texture.c |   2 +-
>  src/gallium/drivers/r300/r300_context.c   |   2 +-
>  src/gallium/drivers/r300/r300_flush.c |   2 +-
>  src/gallium/drivers/r300/r300_query.c |   2 +-
>  src/gallium/drivers/rbug/rbug_context.c   |   2 +-
>  src/gallium/drivers/rbug/rbug_core.c  |   2 +-
>  src/gallium/drivers/rbug/rbug_objects.c   |   2 +-
>  src/gallium/drivers/rbug/rbug_screen.c|   2 +-
>  src/gallium/drivers/trace/tr_context.c|   2 +-
>  src/gallium/drivers/trace/tr_screen.c |   2 +-
>  src/gallium/drivers/trace/tr_texture.c|   2 +-
>  src/gallium/drivers/vc4/vc4_qir.c |   2 +-
>  src/gallium/drivers/vc4/vc4_qir.h |   7 +-
>  src/gallium/winsys/radeon/drm/radeon_drm_bo.c |   2 +-
>  25 files changed, 23 insertions(+), 228 deletions(-)
>  delete mode 100644 src/gallium/auxiliary/util/u_simple_list.h
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965: Handle CMP.nz ... 0 and MOV.nz similarly in cmod propagation.

2015-01-24 Thread Kenneth Graunke
"MOV.nz null src" and "CMP.nz null src 0" are equivalent instructions.

Previously, we deleted MOV.nz instructions when the instruction
generating the MOV's source also wrote the flag register (as the flag
register already contains the desired value).  However, we wouldn't
delete CMP.nz instructions that served the same purpose.

We also didn't attempt true cmod propagation on MOV.nz instructions,
while we would for the equivalent CMP.nz form.

This patch fixes both limitations, treating both forms equally.
CMP.nz instructions will now be deleted (helping the NIR backend),
and MOV.nz instructions will have their .nz propagated.

No changes in shader-db without NIR.  With NIR,

total instructions in shared programs: 6006153 -> 5969364 (-0.61%)
instructions in affected programs: 2087139 -> 2050350 (-1.76%)
helped:10704
HURT:  0
GAINED:2
LOST:  2

Cc: Matt Turner 
Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
index ec9f812..c6384ab 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
@@ -69,8 +69,7 @@ opt_cmod_propagation_local(fs_visitor *v, bblock_t *block)
  continue;
 
   if (inst->opcode == BRW_OPCODE_MOV &&
-  (inst->conditional_mod != BRW_CONDITIONAL_NZ ||
-   inst->src[0].negate))
+  inst->conditional_mod != BRW_CONDITIONAL_NZ)
  continue;
 
   bool read_flag = false;
@@ -81,15 +80,20 @@ opt_cmod_propagation_local(fs_visitor *v, bblock_t *block)
 scan_inst->dst.reg_offset != inst->src[0].reg_offset)
break;
 
-if (inst->opcode == BRW_OPCODE_MOV) {
-   if (!scan_inst->writes_flag())
-  break;
-
+/* If the instruction generating inst's source also wrote the
+ * flag, and inst is doing a simple .nz comparison, then inst
+ * is redundant - the appropriate value is already in the flag
+ * register.  Delete inst.
+ */
+if (inst->conditional_mod == BRW_CONDITIONAL_NZ &&
+!inst->src[0].negate &&
+scan_inst->writes_flag()) {
inst->remove(block);
progress = true;
break;
 }
 
+/* Otherwise, try propagating the conditional. */
 enum brw_conditional_mod cond =
inst->src[0].negate ? brw_swap_cmod(inst->conditional_mod)
: inst->conditional_mod;
-- 
2.2.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 88766] codegen/nv50_ir.h:585:9: error: no member named 'tr1' in namespace 'std'

2015-01-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=88766

--- Comment #5 from Francisco Jerez  ---
(In reply to Ilia Mirkin from comment #4)
> (In reply to Vinson Lee from comment #3)
> > Created attachment 112757 [details] [review] [review]
> > Remove tr1 namespace.
> 
Hi Ilia,

> That would require C++11 support, which I feel a lot worse about requiring
> than having nouveau not compile with clang. I'm surprised that clang chose
> not to ship tr1 headers... oh well.
> 
Actually I suspect your platform support would increase by relying on
the C++11 standard library rather than an on a non-standard extension.
Most likely this bug is not caused by the Clang compiler itself, but by
the standard library implementation.  Apparently FreeBSD ships with
LLVM's libc++ as default implementation these days, which implements the
C++11 standard library and doesn't attempt to support the TR1 namespace,
which is a C++03-specific extension.

> If someone maps out the various version support for all this, perhaps we can
> make a decision. Or some other approach is the standard way to deal with
> this?

I'd suggest we apply Vinson's patch and then build the codegen back-end
with -std=c++0x (available on GCC 4.3 and later), otherwise GNU's
libstdc++ will emit an error if you include any of the C++11 headers
while building in C++98/03 mode.  -std=c++11 would work too but it's
only supported since GCC 4.7.  Any reasonably recent Clang version (at
least 2.9) should support both switches.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] Mesa 10.4.3

2015-01-24 Thread Emil Velikov
Mesa 10.4.3 has been released. Mesa 10.4.3 is a bug fix release
fixing bugs since the 10.4.2 release, (see below for a list of
changes).

The tag in the git repository for Mesa 10.4.3 is 'mesa-10.4.3'.

Mesa 10.4.3 is available for download at
ftp://freedesktop.org/pub/mesa/10.4.3/

SHA-256 checksums:
c53eaafc83d9c6315f63e0904d9954d929b841b0b2be7a328eeb6e14f1376129  
MesaLib-10.4.3.tar.gz
ef6ecc9c2f36c9f78d1662382a69ae961f38f03af3a0c3268e53f351aa1978ad  
MesaLib-10.4.3.tar.bz2
179325fc8ec66529d3b0d0c43ef61a33a44d91daa126c3bbdd1efdfd25a7db1d  
MesaLib-10.4.3.zip


I have verified building from the .tar.bz2 file by doing:

tar xjf MesaLib-10.4.3.tar.bz2
cd Mesa-10.4.3
./configure --enable-gallium-llvm
make -j6
make -j6 install

I have also verified that I pushed the tag.

-Emil

--

Changes from 10.4.2 to 10.4.3:

Axel Davy (39):
  st/nine: Add new texture format strings
  st/nine: Correctly advertise D3DPMISCCAPS_CLIPTLVERTS
  st/nine: NineBaseTexture9: fix setting of last_layer
  st/nine: CubeTexture: fix GetLevelDesc
  st/nine: Fix crash when deleting non-implicit swapchain
  st/nine: Return D3DERR_INVALIDCALL when trying to create a texture of bad 
format
  st/nine: NineBaseTexture9: update sampler view creation
  st/nine: Check if srgb format is supported before trying to use it.
  st/nine: Add ATI1 and ATI2 support
  st/nine: Rework of boolean constants
  st/nine: Convert integer constants to floats before storing them when 
cards don't support integers
  st/nine: Remove some shader unused code
  st/nine: Saturate oFog and oPts vs outputs
  st/nine: Correctly declare NineTranslateInstruction_Mkxn inputs
  st/nine: Fix typo for M4x4
  st/nine: Fix POW implementation
  st/nine: Handle RSQ special cases
  st/nine: Handle NRM with input of null norm
  st/nine: Correct LOG on negative values
  st/nine: Rewrite LOOP implementation, and a0 aL handling
  st/nine: Fix CND implementation
  st/nine: Clamp ps 1.X constants
  st/nine: Fix some fixed function pipeline operation
  st/nine: Implement TEXCOORD special behaviours
  st/nine: Fill missing dst and src number for some instructions.
  st/nine: Fix TEXM3x3 and implement TEXM3x3VSPEC
  st/nine: implement TEXM3x2DEPTH
  st/nine: Implement TEXM3x2TEX
  st/nine: Implement TEXM3x3SPEC
  st/nine: Implement TEXDEPTH
  st/nine: Implement TEXDP3
  st/nine: Implement TEXDP3TEX
  st/nine: Implement TEXREG2AR, TEXREG2GB and TEXREG2RGB
  st/nine: Correct rules for relative adressing and constants.
  st/nine: Remove unused code for ps
  st/nine: Fix sm3 relative addressing for non-debug build
  st/nine: Add variables containing the size of the constant buffers
  st/nine: Allocate the correct size for the user constant buffer
  st/nine: Allocate vs constbuf buffer for indirect addressing once.

Emil Velikov (3):
  docs: Add sha256 sums for the 10.4.2 release
  Update version to 10.4.3
  Add release notes for the 10.4.3 release

Jason Ekstrand (1):
  mesa: Fix clamping to -1.0 in snorm_to_float

Jonathan Gray (1):
  glsl: Link glsl_test with pthreads library.

Jose Fonseca (1):
  nine: Drop use of TGSI_OPCODE_CND.

Kenneth Graunke (2):
  i965: Respect the no_8 flag on Gen6, not just Gen7+.
  i965: Work around mysterious Gen4 GPU hangs with minimal state changes.

Stanislaw Halik (1):
  st/nine: Hack to generate resource if it doesn't exist when getting view

Xavier Bouchoux (3):
  st/nine: Additional defines to d3dtypes.h
  st/nine: Add missing c++ declaration for IDirect3DVolumeTexture9
  st/nine: Fix D3DRS_POINTSPRITE support



signature.asc
Description: OpenPGP digital signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] clover build fail with git llvm

2015-01-24 Thread Andy Furniss

Making all in state_trackers/clover
make[3]: Entering directory 
'/mnt/sdb1/Src64/Mesa-git/mesa/src/gallium/state_trackers/clover'

  CXX  llvm/libclllvm_la-invocation.lo
llvm/invocation.cpp: In function 'void 
{anonymous}::optimize(llvm::Module*, unsigned int, const 
std::vector&)':
llvm/invocation.cpp:335:49: error: no matching function for call to 
'llvm::TargetLibraryInfo::TargetLibraryInfo(llvm::Triple)'

 llvm::Triple(mod->getTargetTriple()));
 ^
llvm/invocation.cpp:335:49: note: candidates are:
In file included from llvm/invocation.cpp:60:0:
/usr/include/llvm/Analysis/TargetLibraryInfo.h:785:3: note: 
llvm::TargetLibraryInfo::TargetLibraryInfo(llvm::TargetLibraryInfo&&)

   TargetLibraryInfo(TargetLibraryInfo &&TLI) : Impl(TLI.Impl) {}
   ^
/usr/include/llvm/Analysis/TargetLibraryInfo.h:785:3: note:   no known 
conversion for argument 1 from 'llvm::Triple' to 'llvm::TargetLibraryInfo&&'
/usr/include/llvm/Analysis/TargetLibraryInfo.h:784:3: note: 
llvm::TargetLibraryInfo::TargetLibraryInfo(const llvm::TargetLibraryInfo&)

   TargetLibraryInfo(const TargetLibraryInfo &TLI) : Impl(TLI.Impl) {}
   ^
/usr/include/llvm/Analysis/TargetLibraryInfo.h:784:3: note:   no known 
conversion for argument 1 from 'llvm::Triple' to 'const 
llvm::TargetLibraryInfo&'
/usr/include/llvm/Analysis/TargetLibraryInfo.h:781:12: note: 
llvm::TargetLibraryInfo::TargetLibraryInfo(const 
llvm::TargetLibraryInfoImpl&)
   explicit TargetLibraryInfo(const TargetLibraryInfoImpl &Impl) : 
Impl(&Impl) {}

^
/usr/include/llvm/Analysis/TargetLibraryInfo.h:781:12: note:   no known 
conversion for argument 1 from 'llvm::Triple' to 'const 
llvm::TargetLibraryInfoImpl&'

Makefile:857: recipe for target 'llvm/libclllvm_la-invocation.lo' failed
make[3]: *** [llvm/libclllvm_la-invocation.lo] Error 1
make[3]: Leaving directory 
'/mnt/sdb1/Src64/Mesa-git/mesa/src/gallium/state_trackers/clover'

Makefile:571: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/mnt/sdb1/Src64/Mesa-git/mesa/src/gallium'
Makefile:656: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/mnt/sdb1/Src64/Mesa-git/mesa/src'
Makefile:599: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 88766] codegen/nv50_ir.h:585:9: error: no member named 'tr1' in namespace 'std'

2015-01-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=88766

Tobias Klausmann  changed:

   What|Removed |Added

 CC||tobias.klausm...@mni.thm.de

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 1/3] nir: Add a pass to lower vector phi nodes to scalar phi nodes

2015-01-24 Thread Connor Abbott
On Sat, Jan 24, 2015 at 1:00 AM, Jason Ekstrand  wrote:
> ---
>  src/glsl/Makefile.sources   |   1 +
>  src/glsl/nir/nir.h  |   2 +
>  src/glsl/nir/nir_lower_phis_to_scalar.c | 238 
> 
>  3 files changed, 241 insertions(+)
>  create mode 100644 src/glsl/nir/nir_lower_phis_to_scalar.c
>
> diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
> index 96c4ec5..02d0780 100644
> --- a/src/glsl/Makefile.sources
> +++ b/src/glsl/Makefile.sources
> @@ -28,6 +28,7 @@ NIR_FILES = \
> nir/nir_lower_global_vars_to_local.c \
> nir/nir_lower_locals_to_regs.c \
> nir/nir_lower_io.c \
> +   nir/nir_lower_phis_to_scalar.c \
> nir/nir_lower_samplers.cpp \
> nir/nir_lower_system_values.c \
> nir/nir_lower_to_source_mods.c \
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index 119ca01..cda14aa 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -1523,6 +1523,8 @@ void nir_remove_dead_variables(nir_shader *shader);
>  void nir_lower_vec_to_movs(nir_shader *shader);
>  void nir_lower_alu_to_scalar(nir_shader *shader);
>
> +void nir_lower_phis_to_scalar(nir_shader *shader);
> +
>  void nir_lower_samplers(nir_shader *shader,
>  struct gl_shader_program *shader_program,
>  struct gl_program *prog);
> diff --git a/src/glsl/nir/nir_lower_phis_to_scalar.c 
> b/src/glsl/nir/nir_lower_phis_to_scalar.c
> new file mode 100644
> index 000..9f901d6
> --- /dev/null
> +++ b/src/glsl/nir/nir_lower_phis_to_scalar.c
> @@ -0,0 +1,238 @@
> +/*
> + * Copyright © 2014 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
> + * IN THE SOFTWARE.
> + *
> + * Authors:
> + *Jason Ekstrand (ja...@jlekstrand.net)
> + *
> + */
> +
> +#include "nir.h"
> +
> +/*
> + * Implements common subexpression elimination
> + */

Whoops...

> +
> +struct lower_phis_to_scalar_state {
> +   void *mem_ctx;
> +   void *dead_ctx;
> +
> +   /* Hash table marking which phi nodes are scalarizable.  The key is
> +* pointers to phi instructions and the entry is either NULL for not
> +* scalarizable or non-null for scalarizable.
> +*/
> +   struct hash_table *phi_table;
> +};
> +
> +/* Determines if the given phi node should be lowered.  The only phi nodes
> + * we will scalarize at the moment are those where all of the sources are
> + * scalarizable.
> + */
> +static bool
> +should_lower_phi(nir_phi_instr *phi, struct lower_phis_to_scalar_state 
> *state)
> +{
> +   /* Already scalar */
> +   if (phi->dest.ssa.num_components == 1)
> +  return false;
> +
> +   struct hash_entry *entry = _mesa_hash_table_search(state->phi_table, phi);
> +   if (entry)
> +  return entry->data != NULL;
> +
> +   nir_foreach_phi_src(phi, src) {
> +  /* Don't know what to do with non-ssa sources */
> +  if (!src->src.is_ssa)
> + return false;
> +
> +  nir_instr *src_instr = src->src.ssa->parent_instr;
> +  switch (src_instr->type) {
> +  case nir_instr_type_alu: {
> + nir_alu_instr *src_alu = nir_instr_as_alu(src_instr);
> +
> + /* ALU operations with output_size == 0 should be scalarized.  We
> +  * will also see a bunch of vecN operations from scalarizing ALU
> +  * operations and, since they can easily be copy-propagated, they
> +  * are ok too.
> +  */
> + return nir_op_infos[src_alu->op].output_size == 0 ||
> +src_alu->op != nir_op_vec2 ||
> +src_alu->op != nir_op_vec3 ||
> +src_alu->op != nir_op_vec4;
> +  }
> +
> +  case nir_instr_type_phi: {
> + nir_phi_instr *src_phi = nir_instr_as_phi(src_instr);
> +
> + /* Insert an entry and mark it as scalarizable for now. That way
> +  * we don't recurse forever and a cycle in th

Re: [Mesa-dev] [PATCH v2 1/3] nir: Add a pass to lower vector phi nodes to scalar phi nodes

2015-01-24 Thread Jason Ekstrand
On Jan 24, 2015 8:18 AM, "Connor Abbott"  wrote:
>
> On Sat, Jan 24, 2015 at 1:00 AM, Jason Ekstrand 
wrote:
> > ---
> >  src/glsl/Makefile.sources   |   1 +
> >  src/glsl/nir/nir.h  |   2 +
> >  src/glsl/nir/nir_lower_phis_to_scalar.c | 238

> >  3 files changed, 241 insertions(+)
> >  create mode 100644 src/glsl/nir/nir_lower_phis_to_scalar.c
> >
> > diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
> > index 96c4ec5..02d0780 100644
> > --- a/src/glsl/Makefile.sources
> > +++ b/src/glsl/Makefile.sources
> > @@ -28,6 +28,7 @@ NIR_FILES = \
> > nir/nir_lower_global_vars_to_local.c \
> > nir/nir_lower_locals_to_regs.c \
> > nir/nir_lower_io.c \
> > +   nir/nir_lower_phis_to_scalar.c \
> > nir/nir_lower_samplers.cpp \
> > nir/nir_lower_system_values.c \
> > nir/nir_lower_to_source_mods.c \
> > diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> > index 119ca01..cda14aa 100644
> > --- a/src/glsl/nir/nir.h
> > +++ b/src/glsl/nir/nir.h
> > @@ -1523,6 +1523,8 @@ void nir_remove_dead_variables(nir_shader
*shader);
> >  void nir_lower_vec_to_movs(nir_shader *shader);
> >  void nir_lower_alu_to_scalar(nir_shader *shader);
> >
> > +void nir_lower_phis_to_scalar(nir_shader *shader);
> > +
> >  void nir_lower_samplers(nir_shader *shader,
> >  struct gl_shader_program *shader_program,
> >  struct gl_program *prog);
> > diff --git a/src/glsl/nir/nir_lower_phis_to_scalar.c
b/src/glsl/nir/nir_lower_phis_to_scalar.c
> > new file mode 100644
> > index 000..9f901d6
> > --- /dev/null
> > +++ b/src/glsl/nir/nir_lower_phis_to_scalar.c
> > @@ -0,0 +1,238 @@
> > +/*
> > + * Copyright © 2014 Intel Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person
obtaining a
> > + * copy of this software and associated documentation files (the
"Software"),
> > + * to deal in the Software without restriction, including without
limitation
> > + * the rights to use, copy, modify, merge, publish, distribute,
sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom
the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including
the next
> > + * paragraph) shall be included in all copies or substantial portions
of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS
> > + * IN THE SOFTWARE.
> > + *
> > + * Authors:
> > + *Jason Ekstrand (ja...@jlekstrand.net)
> > + *
> > + */
> > +
> > +#include "nir.h"
> > +
> > +/*
> > + * Implements common subexpression elimination
> > + */
>
> Whoops...

Yeah, I'll fix that.

>
> > +
> > +struct lower_phis_to_scalar_state {
> > +   void *mem_ctx;
> > +   void *dead_ctx;
> > +
> > +   /* Hash table marking which phi nodes are scalarizable.  The key is
> > +* pointers to phi instructions and the entry is either NULL for not
> > +* scalarizable or non-null for scalarizable.
> > +*/
> > +   struct hash_table *phi_table;
> > +};
> > +
> > +/* Determines if the given phi node should be lowered.  The only phi
nodes
> > + * we will scalarize at the moment are those where all of the sources
are
> > + * scalarizable.
> > + */
> > +static bool
> > +should_lower_phi(nir_phi_instr *phi, struct lower_phis_to_scalar_state
*state)
> > +{
> > +   /* Already scalar */
> > +   if (phi->dest.ssa.num_components == 1)
> > +  return false;
> > +
> > +   struct hash_entry *entry =
_mesa_hash_table_search(state->phi_table, phi);
> > +   if (entry)
> > +  return entry->data != NULL;
> > +
> > +   nir_foreach_phi_src(phi, src) {
> > +  /* Don't know what to do with non-ssa sources */
> > +  if (!src->src.is_ssa)
> > + return false;
> > +
> > +  nir_instr *src_instr = src->src.ssa->parent_instr;
> > +  switch (src_instr->type) {
> > +  case nir_instr_type_alu: {
> > + nir_alu_instr *src_alu = nir_instr_as_alu(src_instr);
> > +
> > + /* ALU operations with output_size == 0 should be
scalarized.  We
> > +  * will also see a bunch of vecN operations from scalarizing
ALU
> > +  * operations and, since they can easily be copy-propagated,
they
> > +  * are ok too.
> > +  */
> > + return nir_op_infos[src_alu->op].output_size == 0 ||
> > +src_alu->op != nir_op_vec2 ||
> > +src_alu->op != nir_op_vec3 ||
> > 

Re: [Mesa-dev] [PATCH v2 1/3] nir: Add a pass to lower vector phi nodes to scalar phi nodes

2015-01-24 Thread Jason Ekstrand
On Jan 24, 2015 9:22 AM, "Jason Ekstrand"  wrote:
>
>
> On Jan 24, 2015 8:18 AM, "Connor Abbott"  wrote:
> >
> > On Sat, Jan 24, 2015 at 1:00 AM, Jason Ekstrand 
wrote:
> > > ---
> > >  src/glsl/Makefile.sources   |   1 +
> > >  src/glsl/nir/nir.h  |   2 +
> > >  src/glsl/nir/nir_lower_phis_to_scalar.c | 238

> > >  3 files changed, 241 insertions(+)
> > >  create mode 100644 src/glsl/nir/nir_lower_phis_to_scalar.c
> > >
> > > diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
> > > index 96c4ec5..02d0780 100644
> > > --- a/src/glsl/Makefile.sources
> > > +++ b/src/glsl/Makefile.sources
> > > @@ -28,6 +28,7 @@ NIR_FILES = \
> > > nir/nir_lower_global_vars_to_local.c \
> > > nir/nir_lower_locals_to_regs.c \
> > > nir/nir_lower_io.c \
> > > +   nir/nir_lower_phis_to_scalar.c \
> > > nir/nir_lower_samplers.cpp \
> > > nir/nir_lower_system_values.c \
> > > nir/nir_lower_to_source_mods.c \
> > > diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> > > index 119ca01..cda14aa 100644
> > > --- a/src/glsl/nir/nir.h
> > > +++ b/src/glsl/nir/nir.h
> > > @@ -1523,6 +1523,8 @@ void nir_remove_dead_variables(nir_shader
*shader);
> > >  void nir_lower_vec_to_movs(nir_shader *shader);
> > >  void nir_lower_alu_to_scalar(nir_shader *shader);
> > >
> > > +void nir_lower_phis_to_scalar(nir_shader *shader);
> > > +
> > >  void nir_lower_samplers(nir_shader *shader,
> > >  struct gl_shader_program *shader_program,
> > >  struct gl_program *prog);
> > > diff --git a/src/glsl/nir/nir_lower_phis_to_scalar.c
b/src/glsl/nir/nir_lower_phis_to_scalar.c
> > > new file mode 100644
> > > index 000..9f901d6
> > > --- /dev/null
> > > +++ b/src/glsl/nir/nir_lower_phis_to_scalar.c
> > > @@ -0,0 +1,238 @@
> > > +/*
> > > + * Copyright © 2014 Intel Corporation
> > > + *
> > > + * Permission is hereby granted, free of charge, to any person
obtaining a
> > > + * copy of this software and associated documentation files (the
"Software"),
> > > + * to deal in the Software without restriction, including without
limitation
> > > + * the rights to use, copy, modify, merge, publish, distribute,
sublicense,
> > > + * and/or sell copies of the Software, and to permit persons to whom
the
> > > + * Software is furnished to do so, subject to the following
conditions:
> > > + *
> > > + * The above copyright notice and this permission notice (including
the next
> > > + * paragraph) shall be included in all copies or substantial
portions of the
> > > + * Software.
> > > + *
> > > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR
> > > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,
> > > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO
EVENT SHALL
> > > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER
> > > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING
> > > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS
> > > + * IN THE SOFTWARE.
> > > + *
> > > + * Authors:
> > > + *Jason Ekstrand (ja...@jlekstrand.net)
> > > + *
> > > + */
> > > +
> > > +#include "nir.h"
> > > +
> > > +/*
> > > + * Implements common subexpression elimination
> > > + */
> >
> > Whoops...
>
> Yeah, I'll fix that.
>
> >
> > > +
> > > +struct lower_phis_to_scalar_state {
> > > +   void *mem_ctx;
> > > +   void *dead_ctx;
> > > +
> > > +   /* Hash table marking which phi nodes are scalarizable.  The key
is
> > > +* pointers to phi instructions and the entry is either NULL for
not
> > > +* scalarizable or non-null for scalarizable.
> > > +*/
> > > +   struct hash_table *phi_table;
> > > +};
> > > +
> > > +/* Determines if the given phi node should be lowered.  The only phi
nodes
> > > + * we will scalarize at the moment are those where all of the
sources are
> > > + * scalarizable.
> > > + */
> > > +static bool
> > > +should_lower_phi(nir_phi_instr *phi, struct
lower_phis_to_scalar_state *state)
> > > +{
> > > +   /* Already scalar */
> > > +   if (phi->dest.ssa.num_components == 1)
> > > +  return false;
> > > +
> > > +   struct hash_entry *entry =
_mesa_hash_table_search(state->phi_table, phi);
> > > +   if (entry)
> > > +  return entry->data != NULL;
> > > +
> > > +   nir_foreach_phi_src(phi, src) {
> > > +  /* Don't know what to do with non-ssa sources */
> > > +  if (!src->src.is_ssa)
> > > + return false;
> > > +
> > > +  nir_instr *src_instr = src->src.ssa->parent_instr;
> > > +  switch (src_instr->type) {
> > > +  case nir_instr_type_alu: {
> > > + nir_alu_instr *src_alu = nir_instr_as_alu(src_instr);
> > > +
> > > + /* ALU operations with output_size == 0 should be
scalarized.  We
> > > +  * will also see a bunch of vecN operations from
scalarizing ALU
> > > + 

[Mesa-dev] [Bug 86837] kodi segfault since auxiliary/vl: rework the build of the VL code

2015-01-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=86837

darkbasic  changed:

   What|Removed |Added

 CC||darkba...@linuxsystems.it

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] configure: Link against all LLVM targets when building clover

2015-01-24 Thread Niels Ole Salscheider
Since 8e7df519bd8556591794b2de08a833a67e34d526, we initialise all targets in
clover. This fixes bug 85380.

v2: Mention correct bug in commit message

Signed-off-by: Niels Ole Salscheider 
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 1cce517..2b7f576 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1902,7 +1902,7 @@ if test "x$enable_gallium_llvm" = xyes; then
 fi
 
 if test "x$enable_opencl" = xyes; then
-LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo linker instrumentation"
+LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker 
instrumentation"
 # LLVM 3.3 >= 177971 requires IRReader
 if $LLVM_CONFIG --components | grep -qw 'irreader'; then
 LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader"
-- 
2.2.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 88766] codegen/nv50_ir.h:585:9: error: no member named 'tr1' in namespace 'std'

2015-01-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=88766

--- Comment #6 from Ilia Mirkin  ---
(In reply to Francisco Jerez from comment #5)
> Most likely this bug is not caused by the Clang compiler itself, but by
> the standard library implementation.  Apparently FreeBSD ships with

Yes, absolutely.

> LLVM's libc++ as default implementation these days, which implements the
> C++11 standard library and doesn't attempt to support the TR1 namespace,
> which is a C++03-specific extension.

OK. nouveau doesn't work on FreeBSD; any reason for me to care about it?

> 
> > If someone maps out the various version support for all this, perhaps we can
> > make a decision. Or some other approach is the standard way to deal with
> > this?
> 
> I'd suggest we apply Vinson's patch and then build the codegen back-end
> with -std=c++0x (available on GCC 4.3 and later), otherwise GNU's
> libstdc++ will emit an error if you include any of the C++11 headers
> while building in C++98/03 mode.  -std=c++11 would work too but it's
> only supported since GCC 4.7.  Any reasonably recent Clang version (at
> least 2.9) should support both switches.

My concern is the boxes on which nouveau works fine but have older compilers
(I'm thinking of RHEL or Ubuntu LTS style situations). I want those to work a
lot more than I want nouveau to build on FreeBSD/OSX/whatever.

IIRC tr1 support came with GCC 4.0 or 4.1 or so, but I don't know which
compilers came with which distros. I guess mesa already requires gcc 4.2 for
something, so moving that up to 4.3 for nouveau may not be such a huge deal. I
guess a patch which turns on -std=c++0x for codegen would be fine by me.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] configure: Link against all LLVM targets when building clover

2015-01-24 Thread Jan Vesely
On Sat, 2015-01-24 at 22:49 +0100, Niels Ole Salscheider wrote:
> Since 8e7df519bd8556591794b2de08a833a67e34d526, we initialise all targets in
> clover. This fixes bug 85380.
> 
> v2: Mention correct bug in commit message
> 
> Signed-off-by: Niels Ole Salscheider 

I thought you already had Tom's rb.
you can add mine as well
Reviewed-by: Jan Vesely 

> ---
>  configure.ac | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 1cce517..2b7f576 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1902,7 +1902,7 @@ if test "x$enable_gallium_llvm" = xyes; then
>  fi
>  
>  if test "x$enable_opencl" = xyes; then
> -LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo linker instrumentation"
> +LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker 
> instrumentation"
>  # LLVM 3.3 >= 177971 requires IRReader
>  if $LLVM_CONFIG --components | grep -qw 'irreader'; then
>  LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader"


-- 
Jan Vesely 


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] configure: Link against all LLVM targets when building clover

2015-01-24 Thread Niels Ole Salscheider
On Saturday 24 January 2015, 18:24:16, Jan Vesely wrote:
> On Sat, 2015-01-24 at 22:49 +0100, Niels Ole Salscheider wrote:
> > Since 8e7df519bd8556591794b2de08a833a67e34d526, we initialise all targets
> > in clover. This fixes bug 85380.
> > 
> > v2: Mention correct bug in commit message
> > 
> > Signed-off-by: Niels Ole Salscheider 
> 
> I thought you already had Tom's rb.
> you can add mine as well
> Reviewed-by: Jan Vesely 

Ok, thanks. But I do not have write access to mesa - would you mind to push it 
for me?

> 
> > ---
> > 
> >  configure.ac | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 1cce517..2b7f576 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1902,7 +1902,7 @@ if test "x$enable_gallium_llvm" = xyes; then
> > 
> >  fi
> >  
> >  if test "x$enable_opencl" = xyes; then
> > 
> > -LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo linker
> > instrumentation" +LLVM_COMPONENTS="${LLVM_COMPONENTS}
> > all-targets ipo linker instrumentation"> 
> >  # LLVM 3.3 >= 177971 requires IRReader
> >  if $LLVM_CONFIG --components | grep -qw 'irreader'; then
> >  
> >  LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader"
> 
> --
> Jan Vesely 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 1/3] nir: Add a pass to lower vector phi nodes to scalar phi nodes

2015-01-24 Thread Connor Abbott
On Sat, Jan 24, 2015 at 12:22 PM, Jason Ekstrand  wrote:
>
> On Jan 24, 2015 8:18 AM, "Connor Abbott"  wrote:
>>
>> On Sat, Jan 24, 2015 at 1:00 AM, Jason Ekstrand 
>> wrote:
>> > ---
>> >  src/glsl/Makefile.sources   |   1 +
>> >  src/glsl/nir/nir.h  |   2 +
>> >  src/glsl/nir/nir_lower_phis_to_scalar.c | 238
>> > 
>> >  3 files changed, 241 insertions(+)
>> >  create mode 100644 src/glsl/nir/nir_lower_phis_to_scalar.c
>> >
>> > diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
>> > index 96c4ec5..02d0780 100644
>> > --- a/src/glsl/Makefile.sources
>> > +++ b/src/glsl/Makefile.sources
>> > @@ -28,6 +28,7 @@ NIR_FILES = \
>> > nir/nir_lower_global_vars_to_local.c \
>> > nir/nir_lower_locals_to_regs.c \
>> > nir/nir_lower_io.c \
>> > +   nir/nir_lower_phis_to_scalar.c \
>> > nir/nir_lower_samplers.cpp \
>> > nir/nir_lower_system_values.c \
>> > nir/nir_lower_to_source_mods.c \
>> > diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
>> > index 119ca01..cda14aa 100644
>> > --- a/src/glsl/nir/nir.h
>> > +++ b/src/glsl/nir/nir.h
>> > @@ -1523,6 +1523,8 @@ void nir_remove_dead_variables(nir_shader
>> > *shader);
>> >  void nir_lower_vec_to_movs(nir_shader *shader);
>> >  void nir_lower_alu_to_scalar(nir_shader *shader);
>> >
>> > +void nir_lower_phis_to_scalar(nir_shader *shader);
>> > +
>> >  void nir_lower_samplers(nir_shader *shader,
>> >  struct gl_shader_program *shader_program,
>> >  struct gl_program *prog);
>> > diff --git a/src/glsl/nir/nir_lower_phis_to_scalar.c
>> > b/src/glsl/nir/nir_lower_phis_to_scalar.c
>> > new file mode 100644
>> > index 000..9f901d6
>> > --- /dev/null
>> > +++ b/src/glsl/nir/nir_lower_phis_to_scalar.c
>> > @@ -0,0 +1,238 @@
>> > +/*
>> > + * Copyright © 2014 Intel Corporation
>> > + *
>> > + * Permission is hereby granted, free of charge, to any person
>> > obtaining a
>> > + * copy of this software and associated documentation files (the
>> > "Software"),
>> > + * to deal in the Software without restriction, including without
>> > limitation
>> > + * the rights to use, copy, modify, merge, publish, distribute,
>> > sublicense,
>> > + * and/or sell copies of the Software, and to permit persons to whom
>> > the
>> > + * Software is furnished to do so, subject to the following conditions:
>> > + *
>> > + * The above copyright notice and this permission notice (including the
>> > next
>> > + * paragraph) shall be included in all copies or substantial portions
>> > of the
>> > + * Software.
>> > + *
>> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> > EXPRESS OR
>> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> > MERCHANTABILITY,
>> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
>> > SHALL
>> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
>> > OTHER
>> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
>> > ARISING
>> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>> > DEALINGS
>> > + * IN THE SOFTWARE.
>> > + *
>> > + * Authors:
>> > + *Jason Ekstrand (ja...@jlekstrand.net)
>> > + *
>> > + */
>> > +
>> > +#include "nir.h"
>> > +
>> > +/*
>> > + * Implements common subexpression elimination
>> > + */
>>
>> Whoops...
>
> Yeah, I'll fix that.
>
>>
>> > +
>> > +struct lower_phis_to_scalar_state {
>> > +   void *mem_ctx;
>> > +   void *dead_ctx;
>> > +
>> > +   /* Hash table marking which phi nodes are scalarizable.  The key is
>> > +* pointers to phi instructions and the entry is either NULL for not
>> > +* scalarizable or non-null for scalarizable.
>> > +*/
>> > +   struct hash_table *phi_table;
>> > +};
>> > +
>> > +/* Determines if the given phi node should be lowered.  The only phi
>> > nodes
>> > + * we will scalarize at the moment are those where all of the sources
>> > are
>> > + * scalarizable.
>> > + */
>> > +static bool
>> > +should_lower_phi(nir_phi_instr *phi, struct lower_phis_to_scalar_state
>> > *state)
>> > +{
>> > +   /* Already scalar */
>> > +   if (phi->dest.ssa.num_components == 1)
>> > +  return false;
>> > +
>> > +   struct hash_entry *entry = _mesa_hash_table_search(state->phi_table,
>> > phi);
>> > +   if (entry)
>> > +  return entry->data != NULL;
>> > +
>> > +   nir_foreach_phi_src(phi, src) {
>> > +  /* Don't know what to do with non-ssa sources */
>> > +  if (!src->src.is_ssa)
>> > + return false;
>> > +
>> > +  nir_instr *src_instr = src->src.ssa->parent_instr;
>> > +  switch (src_instr->type) {
>> > +  case nir_instr_type_alu: {
>> > + nir_alu_instr *src_alu = nir_instr_as_alu(src_instr);
>> > +
>> > + /* ALU operations with output_size == 0 should be scalarized.
>> > We
>> > +  * will also see a bunch of vecN operations from scalarizing
>> > ALU
>> > +   

Re: [Mesa-dev] [PATCH v2 1/3] nir: Add a pass to lower vector phi nodes to scalar phi nodes

2015-01-24 Thread Jason Ekstrand
On Sat, Jan 24, 2015 at 5:01 PM, Connor Abbott  wrote:

> On Sat, Jan 24, 2015 at 12:22 PM, Jason Ekstrand 
> wrote:
> >
> > On Jan 24, 2015 8:18 AM, "Connor Abbott"  wrote:
> >>
> >> On Sat, Jan 24, 2015 at 1:00 AM, Jason Ekstrand 
> >> wrote:
> >> > ---
> >> >  src/glsl/Makefile.sources   |   1 +
> >> >  src/glsl/nir/nir.h  |   2 +
> >> >  src/glsl/nir/nir_lower_phis_to_scalar.c | 238
> >> > 
> >> >  3 files changed, 241 insertions(+)
> >> >  create mode 100644 src/glsl/nir/nir_lower_phis_to_scalar.c
> >> >
> >> > diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
> >> > index 96c4ec5..02d0780 100644
> >> > --- a/src/glsl/Makefile.sources
> >> > +++ b/src/glsl/Makefile.sources
> >> > @@ -28,6 +28,7 @@ NIR_FILES = \
> >> > nir/nir_lower_global_vars_to_local.c \
> >> > nir/nir_lower_locals_to_regs.c \
> >> > nir/nir_lower_io.c \
> >> > +   nir/nir_lower_phis_to_scalar.c \
> >> > nir/nir_lower_samplers.cpp \
> >> > nir/nir_lower_system_values.c \
> >> > nir/nir_lower_to_source_mods.c \
> >> > diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> >> > index 119ca01..cda14aa 100644
> >> > --- a/src/glsl/nir/nir.h
> >> > +++ b/src/glsl/nir/nir.h
> >> > @@ -1523,6 +1523,8 @@ void nir_remove_dead_variables(nir_shader
> >> > *shader);
> >> >  void nir_lower_vec_to_movs(nir_shader *shader);
> >> >  void nir_lower_alu_to_scalar(nir_shader *shader);
> >> >
> >> > +void nir_lower_phis_to_scalar(nir_shader *shader);
> >> > +
> >> >  void nir_lower_samplers(nir_shader *shader,
> >> >  struct gl_shader_program *shader_program,
> >> >  struct gl_program *prog);
> >> > diff --git a/src/glsl/nir/nir_lower_phis_to_scalar.c
> >> > b/src/glsl/nir/nir_lower_phis_to_scalar.c
> >> > new file mode 100644
> >> > index 000..9f901d6
> >> > --- /dev/null
> >> > +++ b/src/glsl/nir/nir_lower_phis_to_scalar.c
> >> > @@ -0,0 +1,238 @@
> >> > +/*
> >> > + * Copyright © 2014 Intel Corporation
> >> > + *
> >> > + * Permission is hereby granted, free of charge, to any person
> >> > obtaining a
> >> > + * copy of this software and associated documentation files (the
> >> > "Software"),
> >> > + * to deal in the Software without restriction, including without
> >> > limitation
> >> > + * the rights to use, copy, modify, merge, publish, distribute,
> >> > sublicense,
> >> > + * and/or sell copies of the Software, and to permit persons to whom
> >> > the
> >> > + * Software is furnished to do so, subject to the following
> conditions:
> >> > + *
> >> > + * The above copyright notice and this permission notice (including
> the
> >> > next
> >> > + * paragraph) shall be included in all copies or substantial portions
> >> > of the
> >> > + * Software.
> >> > + *
> >> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> >> > EXPRESS OR
> >> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> >> > MERCHANTABILITY,
> >> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
> >> > SHALL
> >> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
> OR
> >> > OTHER
> >> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> >> > ARISING
> >> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> OTHER
> >> > DEALINGS
> >> > + * IN THE SOFTWARE.
> >> > + *
> >> > + * Authors:
> >> > + *Jason Ekstrand (ja...@jlekstrand.net)
> >> > + *
> >> > + */
> >> > +
> >> > +#include "nir.h"
> >> > +
> >> > +/*
> >> > + * Implements common subexpression elimination
> >> > + */
> >>
> >> Whoops...
> >
> > Yeah, I'll fix that.
> >
> >>
> >> > +
> >> > +struct lower_phis_to_scalar_state {
> >> > +   void *mem_ctx;
> >> > +   void *dead_ctx;
> >> > +
> >> > +   /* Hash table marking which phi nodes are scalarizable.  The key
> is
> >> > +* pointers to phi instructions and the entry is either NULL for
> not
> >> > +* scalarizable or non-null for scalarizable.
> >> > +*/
> >> > +   struct hash_table *phi_table;
> >> > +};
> >> > +
> >> > +/* Determines if the given phi node should be lowered.  The only phi
> >> > nodes
> >> > + * we will scalarize at the moment are those where all of the sources
> >> > are
> >> > + * scalarizable.
> >> > + */
> >> > +static bool
> >> > +should_lower_phi(nir_phi_instr *phi, struct
> lower_phis_to_scalar_state
> >> > *state)
> >> > +{
> >> > +   /* Already scalar */
> >> > +   if (phi->dest.ssa.num_components == 1)
> >> > +  return false;
> >> > +
> >> > +   struct hash_entry *entry =
> _mesa_hash_table_search(state->phi_table,
> >> > phi);
> >> > +   if (entry)
> >> > +  return entry->data != NULL;
> >> > +
> >> > +   nir_foreach_phi_src(phi, src) {
> >> > +  /* Don't know what to do with non-ssa sources */
> >> > +  if (!src->src.is_ssa)
> >> > + return false;
> >> > +
> >> > +  nir_instr *src_instr = src->src.ssa->par