[llvm-commits] [llvm] r158407 - in /llvm/trunk: lib/Transforms/Scalar/ScalarReplAggregates.cpp test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll

Peter Cooper peter_cooper at apple.com
Wed Jun 13 10:57:41 PDT 2012


This is crashing on bullet.  I've reverted it for now.

Pete
On Jun 13, 2012, at 10:30 AM, Pete Cooper <peter_cooper at apple.com> wrote:

> Author: pete
> Date: Wed Jun 13 12:30:34 2012
> New Revision: 158407
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=158407&view=rev
> Log:
> Allow SROA to look at a vector type and see if the offset is out of range to be replaced with a scalar access
> 
> Modified:
>    llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
>    llvm/trunk/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll
> 
> Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=158407&r1=158406&r2=158407&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Wed Jun 13 12:30:34 2012
> @@ -1764,6 +1764,12 @@
>     if (Offset >= AT->getNumElements() * EltSize)
>       return false;
>     Offset %= EltSize;
> +  } else if (VectorType *VT = dyn_cast<VectorType>(T)) {
> +    EltTy = VT->getElementType();
> +    EltSize = TD->getTypeAllocSize(EltTy);
> +    if (Offset >= VT->getNumElements() * EltSize)
> +      return false;
> +    Offset %= EltSize;
>   } else {
>     return false;
>   }
> 
> Modified: llvm/trunk/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll?rev=158407&r1=158406&r2=158407&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll (original)
> +++ llvm/trunk/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll Wed Jun 13 12:30:34 2012
> @@ -10,8 +10,7 @@
> 
> ; CHECK: main
> ; CHECK-NOT: alloca
> -; CHECK: %[[A:[a-z0-9]*]] = and i128
> -; CHECK: %[[B:[a-z0-9]*]] = trunc i128 %[[A]] to i32
> +; CHECK: extractelement <2 x float> zeroinitializer, i32 0
> 
> define void @main() uwtable ssp {
> entry:
> @@ -28,8 +27,7 @@
> 
> ; CHECK: test1
> ; CHECK-NOT: alloca
> -; CHECK: %[[A:[a-z0-9]*]] = and i128
> -; CHECK: %[[B:[a-z0-9]*]] = trunc i128 %[[A]] to i32
> +; CHECK: extractelement <2 x float> zeroinitializer, i32 0
> 
> define void @test1() uwtable ssp {
> entry:
> @@ -43,9 +41,8 @@
> 
> ; CHECK: test2
> ; CHECK-NOT: alloca
> -; CHECK: and i128
> -; CHECK: or i128
> -; CHECK: trunc i128
> +; CHECK: %[[A:[a-z0-9]*]] = extractelement <2 x float> zeroinitializer, i32 0
> +; CHECK: fadd float %[[A]], 1.000000e+00
> ; CHECK-NOT: insertelement
> ; CHECK-NOT: extractelement
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list