[PATCH] [PR18800] Fix incorrect test case resulting in crash when running vector_memcpy.ll with -sroa

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Mar 12 06:47:16 PDT 2014


This is pr18800 :-)

Since we are patching it, we should probably go all the way to making
the verifier happy.  With this patch we still get

./bin/llvm-as ~/llvm/llvm/test/Transforms/ScalarRepl/vector_memcpy.ll -o test.bc
./bin/llvm-as: assembly parsed, but does not verify as correct!
Intrinsic name not mangled correctly for type arguments! Should be:
llvm.memcpy.p0i8.p0i8.i64
void (i8*, i8*, i64, i32, i1)* @llvm.memcpy.i64
Intrinsic name not mangled correctly for type arguments! Should be:
llvm.memset.p0i8.i64
void (i8*, i8, i64, i32, i1)* @llvm.memset.i64

LGTM with that fixed too.


On 12 March 2014 00:23, Karthik Bhat <kv.bhat at samsung.com> wrote:
> Hi chandlerc, rafael,
>
> Hi Chandler, Rafael,
> llvm intrinsic memcpy takes 5 arguments
>   void @llvm.memcpy.p0i8.p0i8.i32(i8* <dest>, i8* <src>, i32 <len>, i32 <align>, i1 <isvolatile>)
> The test case incorrectly uses the old format resulting in isVolatile function in MemIntrinsic to crash during SROA transformation.
>
> Modified the test case to use correct signature of memcpy and memset.
>
> Could someone please review it for me?
> Thanks
> Karthik Bhat
>
> http://llvm-reviews.chandlerc.com/D3050
>
> Files:
>   test/Transforms/ScalarRepl/vector_memcpy.ll
>
> Index: test/Transforms/ScalarRepl/vector_memcpy.ll
> ===================================================================
> --- test/Transforms/ScalarRepl/vector_memcpy.ll
> +++ test/Transforms/ScalarRepl/vector_memcpy.ll
> @@ -9,7 +9,7 @@
>         store <16 x float> %A, <16 x float>* %tmp
>         %s = bitcast <16 x float>* %tmp to i8*
>         %s2 = bitcast <16 x float>* %tmp2 to i8*
> -       call void @llvm.memcpy.i64(i8* %s2, i8* %s, i64 64, i32 16)
> +       call void @llvm.memcpy.i64(i8* %s2, i8* %s, i64 64, i32 16, i1 false)
>
>         %R = load <16 x float>* %tmp2
>         ret <16 x float> %R
> @@ -19,12 +19,12 @@
>         %tmp2 = alloca <16 x float>, align 16
>
>         %s2 = bitcast <16 x float>* %tmp2 to i8*
> -       call void @llvm.memset.i64(i8* %s2, i8 0, i64 64, i32 16)
> +       call void @llvm.memset.i64(i8* %s2, i8 0, i64 64, i32 16, i1 false)
>
>         %R = load <16 x float>* %tmp2
>         ret <16 x float> %R
>  }
>
>
> -declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind
> -declare void @llvm.memset.i64(i8* nocapture, i8, i64, i32) nounwind
> +declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
> +declare void @llvm.memset.i64(i8* nocapture, i8, i64, i32, i1) nounwind



More information about the llvm-commits mailing list