gallivm: Workaround http://llvm.org/PR18600
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 24 Jan 2014 14:25:46 +0000 (14:25 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 28 Jan 2014 14:27:27 +0000 (14:27 +0000)
commit2eddf91faf4abf0b3d7b81a0a486fd46d5acd1ea
tree48548a0c22a5f73b21bd3aa88f47bd6b2a7d5f14
parent37f1903e007e30892ce39e6e2493c9e88dacf7cc
gallivm: Workaround http://llvm.org/PR18600

We have code generation paths that carry out swizzles of AoS vectors via
bitwise shifts, as these tend to generate more efficient code than
straightforward byte shuffles.  But when the input is a constant the
additional bitwise arithmetic operations somehow don't really get
constant propagated properly, evenutally causing assertion failure in
InstCombine pass.

Therefore avoid the bug by using the trivial shuffles for constant
inputs.

Although the sample LLVM IR can cause a crash with any LLVM version,
this was only seen in practice with LLVM 3.2.

Reviewed-by: Matthew McClure <mcclurem@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_swizzle.c