[llvm-commits] [llvm] r125393 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/bitcast-vec-uniform.ll test/Transforms/InstCombine/fold-vector-select.ll

Benjamin Kramer benny.kra at googlemail.com
Sun Feb 13 06:25:11 PST 2011


On 11.02.2011, at 20:37, Nadav Rotem wrote:

> Author: nadav
> Date: Fri Feb 11 13:37:55 2011
> New Revision: 125393
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=125393&view=rev
> Log:
> Fix 9173.
> 
> Add more folding patterns to constant expressions of vector selects and vector
> bitcasts.
> 
> 
> Added:
>    llvm/trunk/test/Transforms/InstCombine/bitcast-vec-uniform.ll   (with props)
>    llvm/trunk/test/Transforms/InstCombine/fold-vector-select.ll   (with props)
> Modified:
>    llvm/trunk/lib/VMCore/ConstantFold.cpp
> 
> Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=125393&r1=125392&r2=125393&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
> +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Fri Feb 11 13:37:55 2011
> @@ -42,6 +42,10 @@
> /// input vector constant are all simple integer or FP values.
> static Constant *BitCastConstantVector(ConstantVector *CV,
>                                        const VectorType *DstTy) {
> +
> +  if (CV->isAllOnesValue()) return Constant::getAllOnesValue(DstTy);
> +  if (CV->isNullValue()) return Constant::getNullValue(DstTy);
> +

Hi Nadav,

it looks like this change caused a crash in MultiSource/Benchmarks/Bullet in the test-suite,
here's a reduced test case:

define <2 x float> @foo() {
  %cast = bitcast i64 -1 to <2 x float>
  ret <2 x float> %cast
}

the test hits an assertion with "opt -std-compile-opts" because Constant::getAllOnesValue
doesn't know how to handle floats.

- Benjamin



More information about the llvm-commits mailing list