diff options
author | dim <dim@FreeBSD.org> | 2011-07-17 15:36:56 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-07-17 15:36:56 +0000 |
commit | 1176aa52646fe641a4243a246aa7f960c708a274 (patch) | |
tree | c8086addb211fa670a9d2b1038d8c2e453229755 /test/Transforms/InstCombine | |
parent | ece02cd5829cea836e9365b0845a8ef042d17b0a (diff) | |
download | FreeBSD-src-1176aa52646fe641a4243a246aa7f960c708a274.zip FreeBSD-src-1176aa52646fe641a4243a246aa7f960c708a274.tar.gz |
Vendor import of llvm trunk r135360:
http://llvm.org/svn/llvm-project/llvm/trunk@135360
Diffstat (limited to 'test/Transforms/InstCombine')
36 files changed, 474 insertions, 516 deletions
diff --git a/test/Transforms/InstCombine/2006-11-03-Memmove64.ll b/test/Transforms/InstCombine/2006-11-03-Memmove64.ll deleted file mode 100644 index 35bb45e..0000000 --- a/test/Transforms/InstCombine/2006-11-03-Memmove64.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: opt < %s -instcombine -S | \ -; RUN: not grep memmove.i32 -; Instcombine was trying to turn this into a memmove.i32 - -target datalayout = "e-p:64:64" -target triple = "alphaev67-unknown-linux-gnu" -@str10 = internal constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1] - -define void @do_join(i8* %b) { -entry: - call void @llvm.memmove.i64( i8* %b, i8* getelementptr ([1 x i8]* @str10, i32 0, i64 0), i64 1, i32 1 ) - ret void -} - -declare void @llvm.memmove.i64(i8*, i8*, i64, i32) - diff --git a/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll b/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll deleted file mode 100644 index b59d3c8..0000000 --- a/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll +++ /dev/null @@ -1,19 +0,0 @@ -; In the presence of a negative offset (the -8 below), a fold of a bitcast into -; a malloc messes up the element count, causing an extra 4GB to be allocated on -; 64-bit targets. -; -; RUN: opt < %s -instcombine -S | not grep {= add } - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" -target triple = "x86_64-unknown-freebsd6.2" - -define i1 @test(i32 %tmp141, double** %tmp145) -{ - %tmp133 = add i32 %tmp141, 1 - %tmp134 = shl i32 %tmp133, 3 - %tmp135 = add i32 %tmp134, -8 - %tmp136 = malloc i8, i32 %tmp135 - %tmp137 = bitcast i8* %tmp136 to double* - store double* %tmp137, double** %tmp145 - ret i1 false -} diff --git a/test/Transforms/InstCombine/2007-05-04-Crash.ll b/test/Transforms/InstCombine/2007-05-04-Crash.ll deleted file mode 100644 index 9f50d8a..0000000 --- a/test/Transforms/InstCombine/2007-05-04-Crash.ll +++ /dev/null @@ -1,30 +0,0 @@ -; RUN: opt < %s -instcombine -disable-output -; PR1384 - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" -target triple = "i686-apple-darwin8" - %struct.CFRuntimeBase = type { i32, [4 x i8] } - %struct.CGColor = type opaque - %struct.CGColorSpace = type { %struct.CFRuntimeBase, i8, i8, i8, i32, i32, i32, %struct.CGColor*, float*, %struct.CGMD5Signature, %struct.CGMD5Signature*, [0 x %struct.CGColorSpaceDescriptor] } - %struct.CGColorSpaceCalibratedRGBData = type { [3 x float], [3 x float], [3 x float], [9 x float] } - %struct.CGColorSpaceDescriptor = type { %struct.CGColorSpaceCalibratedRGBData } - %struct.CGColorSpaceLabData = type { [3 x float], [3 x float], [4 x float] } - %struct.CGMD5Signature = type { [16 x i8], i8 } - -declare fastcc %struct.CGColorSpace* @CGColorSpaceCreate(i32, i32) - -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) - -define %struct.CGColorSpace* @CGColorSpaceCreateLab(float* %whitePoint, float* %blackPoint, float* %range) { -entry: - %tmp17 = call fastcc %struct.CGColorSpace* @CGColorSpaceCreate( i32 5, i32 3 ) ; <%struct.CGColorSpace*> [#uses=2] - %tmp28 = getelementptr %struct.CGColorSpace* %tmp17, i32 0, i32 11 ; <[0 x %struct.CGColorSpaceDescriptor]*> [#uses=1] - %tmp29 = getelementptr [0 x %struct.CGColorSpaceDescriptor]* %tmp28, i32 0, i32 0 ; <%struct.CGColorSpaceDescriptor*> [#uses=1] - %tmp30 = getelementptr %struct.CGColorSpaceDescriptor* %tmp29, i32 0, i32 0 ; <%struct.CGColorSpaceCalibratedRGBData*> [#uses=1] - %tmp3031 = bitcast %struct.CGColorSpaceCalibratedRGBData* %tmp30 to %struct.CGColorSpaceLabData* ; <%struct.CGColorSpaceLabData*> [#uses=1] - %tmp45 = getelementptr %struct.CGColorSpaceLabData* %tmp3031, i32 0, i32 2 ; <[4 x float]*> [#uses=1] - %tmp46 = getelementptr [4 x float]* %tmp45, i32 0, i32 0 ; <float*> [#uses=1] - %tmp4648 = bitcast float* %tmp46 to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %tmp4648, i8* null, i32 16, i32 4 ) - ret %struct.CGColorSpace* %tmp17 -} diff --git a/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll b/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll index 40818d4..15988b6 100644 --- a/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll +++ b/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll @@ -3,7 +3,7 @@ define void @blah(i16* %tmp10) { entry: - call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16* sret )*)( i16* %tmp10 sret ) + call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16*)*)( i16* sret %tmp10 ) ret void } diff --git a/test/Transforms/InstCombine/2007-09-11-Trampoline.ll b/test/Transforms/InstCombine/2007-09-11-Trampoline.ll index d8f3d97..6190aa9 100644 --- a/test/Transforms/InstCombine/2007-09-11-Trampoline.ll +++ b/test/Transforms/InstCombine/2007-09-11-Trampoline.ll @@ -15,7 +15,7 @@ entry: %tmp3 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 0 ; <i32*> [#uses=1] store i32 %n, i32* %tmp3, align 8 %FRAME.06 = bitcast %struct.FRAME.nest* %FRAME.0 to i8* ; <i8*> [#uses=1] - %tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest* nest , i32)* @f to i8*), i8* %FRAME.06 ) ; <i8*> [#uses=1] + %tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest* , i32)* @f to i8*), i8* %FRAME.06 ) ; <i8*> [#uses=1] %tmp7 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 1 ; <i32 (i32)**> [#uses=1] %tmp89 = bitcast i8* %tramp to i32 (i32)* ; <i32 (i32)*> [#uses=2] store i32 (i32)* %tmp89, i32 (i32)** %tmp7, align 8 diff --git a/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll b/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll index 710aff2..fe935f9 100644 --- a/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll +++ b/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll @@ -6,16 +6,15 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1 define void @foo(i8* %P) { entry: - %P_addr = alloca i8* ; <i8**> [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - store i8* %P, i8** %P_addr - %tmp = load i8** %P_addr, align 4 ; <i8*> [#uses=1] - %tmp1 = getelementptr [4 x i8]* @.str, i32 0, i32 0 ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %tmp, i8* %tmp1, i32 4, i32 1 ) - br label %return + %P_addr = alloca i8* + store i8* %P, i8** %P_addr + %tmp = load i8** %P_addr, align 4 + %tmp1 = getelementptr [4 x i8]* @.str, i32 0, i32 0 + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp, i8* %tmp1, i32 4, i32 1, i1 false) + br label %return -return: ; preds = %entry - ret void +return: ; preds = %entry + ret void } -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll b/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll index e1549a0..e6c9bcd 100644 --- a/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll +++ b/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll @@ -5,8 +5,8 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 target triple = "i686-pc-linux-gnu" %opaque_t = type opaque - -%op_ts = type {opaque, i32} +%opaque2 = type opaque +%op_ts = type {%opaque2, i32} @g = external global %opaque_t @h = external global %op_ts diff --git a/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll b/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll index 24394c6..e3192a9 100644 --- a/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll +++ b/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll @@ -5,7 +5,7 @@ define i32 @main(i32 %argc, i8** %argv) { entry: - %tmp32 = tail call i32 (i8* noalias , ...) nounwind * bitcast (i32 (i8*, ...) nounwind * @printf to i32 (i8* noalias , ...) nounwind *)( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0) noalias , i32 0 ) nounwind ; <i32> [#uses=0] + %tmp32 = tail call i32 (i8* , ...) * bitcast (i32 (i8*, ...) * @printf to i32 (i8* , ...) *)( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0) , i32 0 ) nounwind ; <i32> [#uses=0] ret i32 undef } diff --git a/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll b/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll index 5f4fa47..23b6067 100644 --- a/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll +++ b/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll @@ -5,7 +5,7 @@ define void @a() { ret void } -define i32 @b(i32* inreg %x) signext { +define signext i32 @b(i32* inreg %x) { ret i32 0 } diff --git a/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll b/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll index 7b3281f..510a68c 100644 --- a/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll +++ b/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -instcombine -S | grep bitcast | count 2 -define i32 @b(i32* inreg %x) signext { +define signext i32 @b(i32* inreg %x) { ret i32 0 } diff --git a/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll b/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll index b29d8d2..a51c47d 100644 --- a/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll +++ b/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll @@ -4,275 +4,276 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin9.6" - %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" = type { i32* } - %"struct.std::_Vector_base<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" } - %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" = type { i32*, i32*, i32* } - %"struct.std::bidirectional_iterator_tag" = type <{ i8 }> - %"struct.std::forward_iterator_tag" = type <{ i8 }> - %"struct.std::input_iterator_tag" = type <{ i8 }> - %"struct.std::random_access_iterator_tag" = type <{ i8 }> - %"struct.std::vector<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >" } + +%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" = type { i32* } +%"struct.std::_Vector_base<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" } +%"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" = type { i32*, i32*, i32* } +%"struct.std::bidirectional_iterator_tag" = type <{ i8 }> +%"struct.std::forward_iterator_tag" = type <{ i8 }> +%"struct.std::input_iterator_tag" = type <{ i8 }> +%"struct.std::random_access_iterator_tag" = type <{ i8 }> +%"struct.std::vector<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >" } define i32* @_Z3fooRSt6vectorIiSaIiEE(%"struct.std::vector<int,std::allocator<int> >"* %X) { entry: - %0 = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=2] - %__first_addr.i.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=31] - %__last_addr.i.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=4] - %unnamed_arg.i = alloca %"struct.std::bidirectional_iterator_tag", align 8 ; <%"struct.std::bidirectional_iterator_tag"*> [#uses=1] - %1 = alloca %"struct.std::bidirectional_iterator_tag" ; <%"struct.std::bidirectional_iterator_tag"*> [#uses=1] - %__first_addr.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=2] - %2 = alloca %"struct.std::bidirectional_iterator_tag" ; <%"struct.std::bidirectional_iterator_tag"*> [#uses=2] - %3 = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=2] - %4 = alloca i32 ; <i32*> [#uses=8] - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - store i32 42, i32* %4, align 4 - %5 = getelementptr %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0 ; <%"struct.std::_Vector_base<int,std::allocator<int> >"*> [#uses=1] - %6 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >"* %5, i32 0, i32 0 ; <%"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"*> [#uses=1] - %7 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %6, i32 0, i32 1 ; <i32**> [#uses=1] - %8 = load i32** %7, align 4 ; <i32*> [#uses=1] - %9 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %8, i32** %9, align 4 - %10 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0 ; <i32**> [#uses=1] - %11 = load i32** %10, align 4 ; <i32*> [#uses=1] - %tmp2.i = ptrtoint i32* %11 to i32 ; <i32> [#uses=1] - %tmp1.i = inttoptr i32 %tmp2.i to i32* ; <i32*> [#uses=1] - %tmp3 = ptrtoint i32* %tmp1.i to i32 ; <i32> [#uses=1] - %tmp2 = inttoptr i32 %tmp3 to i32* ; <i32*> [#uses=1] - %12 = getelementptr %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0 ; <%"struct.std::_Vector_base<int,std::allocator<int> >"*> [#uses=1] - %13 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >"* %12, i32 0, i32 0 ; <%"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"*> [#uses=1] - %14 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %13, i32 0, i32 0 ; <i32**> [#uses=1] - %15 = load i32** %14, align 4 ; <i32*> [#uses=1] - %16 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %15, i32** %16, align 4 - %17 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0 ; <i32**> [#uses=1] - %18 = load i32** %17, align 4 ; <i32*> [#uses=1] - %tmp2.i17 = ptrtoint i32* %18 to i32 ; <i32> [#uses=1] - %tmp1.i18 = inttoptr i32 %tmp2.i17 to i32* ; <i32*> [#uses=1] - %tmp8 = ptrtoint i32* %tmp1.i18 to i32 ; <i32> [#uses=1] - %tmp6 = inttoptr i32 %tmp8 to i32* ; <i32*> [#uses=1] - %19 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %tmp6, i32** %19 - %20 = getelementptr %"struct.std::bidirectional_iterator_tag"* %1, i32 0, i32 0 ; <i8*> [#uses=1] - %21 = load i8* %20, align 1 ; <i8> [#uses=1] - %22 = or i8 %21, 0 ; <i8> [#uses=1] - %23 = or i8 %22, 0 ; <i8> [#uses=1] - %24 = or i8 %23, 0 ; <i8> [#uses=0] - %25 = getelementptr %"struct.std::bidirectional_iterator_tag"* %2, i32 0, i32 0 ; <i8*> [#uses=1] - store i8 0, i8* %25, align 1 - %elt.i = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0 ; <i32**> [#uses=1] - %val.i = load i32** %elt.i ; <i32*> [#uses=1] - %tmp.i = bitcast %"struct.std::bidirectional_iterator_tag"* %unnamed_arg.i to i8* ; <i8*> [#uses=1] - %tmp9.i = bitcast %"struct.std::bidirectional_iterator_tag"* %2 to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i64(i8* %tmp.i, i8* %tmp9.i, i64 1, i32 1) - %26 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %val.i, i32** %26 - %27 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %tmp2, i32** %27 - %28 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %29 = load i32** %28, align 4 ; <i32*> [#uses=1] - %30 = ptrtoint i32* %29 to i32 ; <i32> [#uses=1] - %31 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %32 = load i32** %31, align 4 ; <i32*> [#uses=1] - %33 = ptrtoint i32* %32 to i32 ; <i32> [#uses=1] - %34 = sub i32 %30, %33 ; <i32> [#uses=1] - %35 = ashr i32 %34, 2 ; <i32> [#uses=1] - %36 = ashr i32 %35, 2 ; <i32> [#uses=1] - br label %bb12.i.i + %0 = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" + %__first_addr.i.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" + %__last_addr.i.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" + %unnamed_arg.i = alloca %"struct.std::bidirectional_iterator_tag", align 8 + %1 = alloca %"struct.std::bidirectional_iterator_tag" + %__first_addr.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" + %2 = alloca %"struct.std::bidirectional_iterator_tag" + %3 = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" + %4 = alloca i32 + %"alloca point" = bitcast i32 0 to i32 + store i32 42, i32* %4, align 4 + %5 = getelementptr %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0 + %6 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >"* %5, i32 0, i32 0 + %7 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %6, i32 0, i32 1 + %8 = load i32** %7, align 4 + %9 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0 + store i32* %8, i32** %9, align 4 + %10 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0 + %11 = load i32** %10, align 4 + %tmp2.i = ptrtoint i32* %11 to i32 + %tmp1.i = inttoptr i32 %tmp2.i to i32* + %tmp3 = ptrtoint i32* %tmp1.i to i32 + %tmp2 = inttoptr i32 %tmp3 to i32* + %12 = getelementptr %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0 + %13 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >"* %12, i32 0, i32 0 + %14 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %13, i32 0, i32 0 + %15 = load i32** %14, align 4 + %16 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0 + store i32* %15, i32** %16, align 4 + %17 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0 + %18 = load i32** %17, align 4 + %tmp2.i17 = ptrtoint i32* %18 to i32 + %tmp1.i18 = inttoptr i32 %tmp2.i17 to i32* + %tmp8 = ptrtoint i32* %tmp1.i18 to i32 + %tmp6 = inttoptr i32 %tmp8 to i32* + %19 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0 + store i32* %tmp6, i32** %19 + %20 = getelementptr %"struct.std::bidirectional_iterator_tag"* %1, i32 0, i32 0 + %21 = load i8* %20, align 1 + %22 = or i8 %21, 0 + %23 = or i8 %22, 0 + %24 = or i8 %23, 0 + %25 = getelementptr %"struct.std::bidirectional_iterator_tag"* %2, i32 0, i32 0 + store i8 0, i8* %25, align 1 + %elt.i = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0 + %val.i = load i32** %elt.i + %tmp.i = bitcast %"struct.std::bidirectional_iterator_tag"* %unnamed_arg.i to i8* + %tmp9.i = bitcast %"struct.std::bidirectional_iterator_tag"* %2 to i8* + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp.i, i8* %tmp9.i, i64 1, i32 1, i1 false) + %26 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %val.i, i32** %26 + %27 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 + store i32* %tmp2, i32** %27 + %28 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 + %29 = load i32** %28, align 4 + %30 = ptrtoint i32* %29 to i32 + %31 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %32 = load i32** %31, align 4 + %33 = ptrtoint i32* %32 to i32 + %34 = sub i32 %30, %33 + %35 = ashr i32 %34, 2 + %36 = ashr i32 %35, 2 + br label %bb12.i.i -bb.i.i: ; preds = %bb12.i.i - %37 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %38 = load i32** %37, align 4 ; <i32*> [#uses=1] - %39 = load i32* %38, align 4 ; <i32> [#uses=1] - %40 = load i32* %4, align 4 ; <i32> [#uses=1] - %41 = icmp eq i32 %39, %40 ; <i1> [#uses=1] - %42 = zext i1 %41 to i8 ; <i8> [#uses=1] - %toBool.i.i = icmp ne i8 %42, 0 ; <i1> [#uses=1] - br i1 %toBool.i.i, label %bb1.i.i, label %bb2.i.i +bb.i.i: ; preds = %bb12.i.i + %37 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %38 = load i32** %37, align 4 + %39 = load i32* %38, align 4 + %40 = load i32* %4, align 4 + %41 = icmp eq i32 %39, %40 + %42 = zext i1 %41 to i8 + %toBool.i.i = icmp ne i8 %42, 0 + br i1 %toBool.i.i, label %bb1.i.i, label %bb2.i.i -bb1.i.i: ; preds = %bb.i.i - %43 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %44 = load i32** %43, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb1.i.i: ; preds = %bb.i.i + %43 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %44 = load i32** %43, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb2.i.i: ; preds = %bb.i.i - %45 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %46 = load i32** %45, align 4 ; <i32*> [#uses=1] - %47 = getelementptr i32* %46, i64 1 ; <i32*> [#uses=1] - %48 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %47, i32** %48, align 4 - %49 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %50 = load i32** %49, align 4 ; <i32*> [#uses=1] - %51 = load i32* %50, align 4 ; <i32> [#uses=1] - %52 = load i32* %4, align 4 ; <i32> [#uses=1] - %53 = icmp eq i32 %51, %52 ; <i1> [#uses=1] - %54 = zext i1 %53 to i8 ; <i8> [#uses=1] - %toBool3.i.i = icmp ne i8 %54, 0 ; <i1> [#uses=1] - br i1 %toBool3.i.i, label %bb4.i.i, label %bb5.i.i +bb2.i.i: ; preds = %bb.i.i + %45 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %46 = load i32** %45, align 4 + %47 = getelementptr i32* %46, i64 1 + %48 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %47, i32** %48, align 4 + %49 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %50 = load i32** %49, align 4 + %51 = load i32* %50, align 4 + %52 = load i32* %4, align 4 + %53 = icmp eq i32 %51, %52 + %54 = zext i1 %53 to i8 + %toBool3.i.i = icmp ne i8 %54, 0 + br i1 %toBool3.i.i, label %bb4.i.i, label %bb5.i.i -bb4.i.i: ; preds = %bb2.i.i - %55 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %56 = load i32** %55, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb4.i.i: ; preds = %bb2.i.i + %55 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %56 = load i32** %55, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb5.i.i: ; preds = %bb2.i.i - %57 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %58 = load i32** %57, align 4 ; <i32*> [#uses=1] - %59 = getelementptr i32* %58, i64 1 ; <i32*> [#uses=1] - %60 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %59, i32** %60, align 4 - %61 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %62 = load i32** %61, align 4 ; <i32*> [#uses=1] - %63 = load i32* %62, align 4 ; <i32> [#uses=1] - %64 = load i32* %4, align 4 ; <i32> [#uses=1] - %65 = icmp eq i32 %63, %64 ; <i1> [#uses=1] - %66 = zext i1 %65 to i8 ; <i8> [#uses=1] - %toBool6.i.i = icmp ne i8 %66, 0 ; <i1> [#uses=1] - br i1 %toBool6.i.i, label %bb7.i.i, label %bb8.i.i +bb5.i.i: ; preds = %bb2.i.i + %57 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %58 = load i32** %57, align 4 + %59 = getelementptr i32* %58, i64 1 + %60 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %59, i32** %60, align 4 + %61 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %62 = load i32** %61, align 4 + %63 = load i32* %62, align 4 + %64 = load i32* %4, align 4 + %65 = icmp eq i32 %63, %64 + %66 = zext i1 %65 to i8 + %toBool6.i.i = icmp ne i8 %66, 0 + br i1 %toBool6.i.i, label %bb7.i.i, label %bb8.i.i -bb7.i.i: ; preds = %bb5.i.i - %67 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %68 = load i32** %67, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb7.i.i: ; preds = %bb5.i.i + %67 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %68 = load i32** %67, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb8.i.i: ; preds = %bb5.i.i - %69 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %70 = load i32** %69, align 4 ; <i32*> [#uses=1] - %71 = getelementptr i32* %70, i64 1 ; <i32*> [#uses=1] - %72 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %71, i32** %72, align 4 - %73 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %74 = load i32** %73, align 4 ; <i32*> [#uses=1] - %75 = load i32* %74, align 4 ; <i32> [#uses=1] - %76 = load i32* %4, align 4 ; <i32> [#uses=1] - %77 = icmp eq i32 %75, %76 ; <i1> [#uses=1] - %78 = zext i1 %77 to i8 ; <i8> [#uses=1] - %toBool9.i.i = icmp ne i8 %78, 0 ; <i1> [#uses=1] - br i1 %toBool9.i.i, label %bb10.i.i, label %bb11.i.i +bb8.i.i: ; preds = %bb5.i.i + %69 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %70 = load i32** %69, align 4 + %71 = getelementptr i32* %70, i64 1 + %72 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %71, i32** %72, align 4 + %73 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %74 = load i32** %73, align 4 + %75 = load i32* %74, align 4 + %76 = load i32* %4, align 4 + %77 = icmp eq i32 %75, %76 + %78 = zext i1 %77 to i8 + %toBool9.i.i = icmp ne i8 %78, 0 + br i1 %toBool9.i.i, label %bb10.i.i, label %bb11.i.i -bb10.i.i: ; preds = %bb8.i.i - %79 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %80 = load i32** %79, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb10.i.i: ; preds = %bb8.i.i + %79 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %80 = load i32** %79, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb11.i.i: ; preds = %bb8.i.i - %81 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %82 = load i32** %81, align 4 ; <i32*> [#uses=1] - %83 = getelementptr i32* %82, i64 1 ; <i32*> [#uses=1] - %84 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %83, i32** %84, align 4 - %85 = sub i32 %__trip_count.0.i.i, 1 ; <i32> [#uses=1] - br label %bb12.i.i +bb11.i.i: ; preds = %bb8.i.i + %81 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %82 = load i32** %81, align 4 + %83 = getelementptr i32* %82, i64 1 + %84 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %83, i32** %84, align 4 + %85 = sub i32 %__trip_count.0.i.i, 1 + br label %bb12.i.i -bb12.i.i: ; preds = %bb11.i.i, %entry - %__trip_count.0.i.i = phi i32 [ %36, %entry ], [ %85, %bb11.i.i ] ; <i32> [#uses=2] - %86 = icmp sgt i32 %__trip_count.0.i.i, 0 ; <i1> [#uses=1] - br i1 %86, label %bb.i.i, label %bb13.i.i +bb12.i.i: ; preds = %bb11.i.i, %entry + %__trip_count.0.i.i = phi i32 [ %36, %entry ], [ %85, %bb11.i.i ] + %86 = icmp sgt i32 %__trip_count.0.i.i, 0 + br i1 %86, label %bb.i.i, label %bb13.i.i -bb13.i.i: ; preds = %bb12.i.i - %87 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %88 = load i32** %87, align 4 ; <i32*> [#uses=1] - %89 = ptrtoint i32* %88 to i32 ; <i32> [#uses=1] - %90 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %91 = load i32** %90, align 4 ; <i32*> [#uses=1] - %92 = ptrtoint i32* %91 to i32 ; <i32> [#uses=1] - %93 = sub i32 %89, %92 ; <i32> [#uses=1] - %94 = ashr i32 %93, 2 ; <i32> [#uses=1] - switch i32 %94, label %bb26.i.i [ - i32 1, label %bb22.i.i - i32 2, label %bb18.i.i - i32 3, label %bb14.i.i - ] +bb13.i.i: ; preds = %bb12.i.i + %87 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 + %88 = load i32** %87, align 4 + %89 = ptrtoint i32* %88 to i32 + %90 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %91 = load i32** %90, align 4 + %92 = ptrtoint i32* %91 to i32 + %93 = sub i32 %89, %92 + %94 = ashr i32 %93, 2 + switch i32 %94, label %bb26.i.i [ + i32 1, label %bb22.i.i + i32 2, label %bb18.i.i + i32 3, label %bb14.i.i + ] -bb14.i.i: ; preds = %bb13.i.i - %95 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %96 = load i32** %95, align 4 ; <i32*> [#uses=1] - %97 = load i32* %96, align 4 ; <i32> [#uses=1] - %98 = load i32* %4, align 4 ; <i32> [#uses=1] - %99 = icmp eq i32 %97, %98 ; <i1> [#uses=1] - %100 = zext i1 %99 to i8 ; <i8> [#uses=1] - %toBool15.i.i = icmp ne i8 %100, 0 ; <i1> [#uses=1] - br i1 %toBool15.i.i, label %bb16.i.i, label %bb17.i.i +bb14.i.i: ; preds = %bb13.i.i + %95 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %96 = load i32** %95, align 4 + %97 = load i32* %96, align 4 + %98 = load i32* %4, align 4 + %99 = icmp eq i32 %97, %98 + %100 = zext i1 %99 to i8 + %toBool15.i.i = icmp ne i8 %100, 0 + br i1 %toBool15.i.i, label %bb16.i.i, label %bb17.i.i -bb16.i.i: ; preds = %bb14.i.i - %101 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %102 = load i32** %101, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb16.i.i: ; preds = %bb14.i.i + %101 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %102 = load i32** %101, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb17.i.i: ; preds = %bb14.i.i - %103 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %104 = load i32** %103, align 4 ; <i32*> [#uses=1] - %105 = getelementptr i32* %104, i64 1 ; <i32*> [#uses=1] - %106 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %105, i32** %106, align 4 - br label %bb18.i.i +bb17.i.i: ; preds = %bb14.i.i + %103 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %104 = load i32** %103, align 4 + %105 = getelementptr i32* %104, i64 1 + %106 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %105, i32** %106, align 4 + br label %bb18.i.i -bb18.i.i: ; preds = %bb17.i.i, %bb13.i.i - %107 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %108 = load i32** %107, align 4 ; <i32*> [#uses=1] - %109 = load i32* %108, align 4 ; <i32> [#uses=1] - %110 = load i32* %4, align 4 ; <i32> [#uses=1] - %111 = icmp eq i32 %109, %110 ; <i1> [#uses=1] - %112 = zext i1 %111 to i8 ; <i8> [#uses=1] - %toBool19.i.i = icmp ne i8 %112, 0 ; <i1> [#uses=1] - br i1 %toBool19.i.i, label %bb20.i.i, label %bb21.i.i +bb18.i.i: ; preds = %bb17.i.i, %bb13.i.i + %107 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %108 = load i32** %107, align 4 + %109 = load i32* %108, align 4 + %110 = load i32* %4, align 4 + %111 = icmp eq i32 %109, %110 + %112 = zext i1 %111 to i8 + %toBool19.i.i = icmp ne i8 %112, 0 + br i1 %toBool19.i.i, label %bb20.i.i, label %bb21.i.i -bb20.i.i: ; preds = %bb18.i.i - %113 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %114 = load i32** %113, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb20.i.i: ; preds = %bb18.i.i + %113 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %114 = load i32** %113, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb21.i.i: ; preds = %bb18.i.i - %115 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %116 = load i32** %115, align 4 ; <i32*> [#uses=1] - %117 = getelementptr i32* %116, i64 1 ; <i32*> [#uses=1] - %118 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %117, i32** %118, align 4 - br label %bb22.i.i +bb21.i.i: ; preds = %bb18.i.i + %115 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %116 = load i32** %115, align 4 + %117 = getelementptr i32* %116, i64 1 + %118 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %117, i32** %118, align 4 + br label %bb22.i.i -bb22.i.i: ; preds = %bb21.i.i, %bb13.i.i - %119 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %120 = load i32** %119, align 4 ; <i32*> [#uses=1] - %121 = load i32* %120, align 4 ; <i32> [#uses=1] - %122 = load i32* %4, align 4 ; <i32> [#uses=1] - %123 = icmp eq i32 %121, %122 ; <i1> [#uses=1] - %124 = zext i1 %123 to i8 ; <i8> [#uses=1] - %toBool23.i.i = icmp ne i8 %124, 0 ; <i1> [#uses=1] - br i1 %toBool23.i.i, label %bb24.i.i, label %bb25.i.i +bb22.i.i: ; preds = %bb21.i.i, %bb13.i.i + %119 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %120 = load i32** %119, align 4 + %121 = load i32* %120, align 4 + %122 = load i32* %4, align 4 + %123 = icmp eq i32 %121, %122 + %124 = zext i1 %123 to i8 + %toBool23.i.i = icmp ne i8 %124, 0 + br i1 %toBool23.i.i, label %bb24.i.i, label %bb25.i.i -bb24.i.i: ; preds = %bb22.i.i - %125 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %126 = load i32** %125, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb24.i.i: ; preds = %bb22.i.i + %125 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %126 = load i32** %125, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb25.i.i: ; preds = %bb22.i.i - %127 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %128 = load i32** %127, align 4 ; <i32*> [#uses=1] - %129 = getelementptr i32* %128, i64 1 ; <i32*> [#uses=1] - %130 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %129, i32** %130, align 4 - br label %bb26.i.i +bb25.i.i: ; preds = %bb22.i.i + %127 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %128 = load i32** %127, align 4 + %129 = getelementptr i32* %128, i64 1 + %130 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %129, i32** %130, align 4 + br label %bb26.i.i -bb26.i.i: ; preds = %bb25.i.i, %bb13.i.i - %131 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %132 = load i32** %131, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb26.i.i: ; preds = %bb25.i.i, %bb13.i.i + %131 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 + %132 = load i32** %131, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit: ; preds = %bb26.i.i, %bb24.i.i, %bb20.i.i, %bb16.i.i, %bb10.i.i, %bb7.i.i, %bb4.i.i, %bb1.i.i - %.0.0.i.i = phi i32* [ %132, %bb26.i.i ], [ %126, %bb24.i.i ], [ %114, %bb20.i.i ], [ %102, %bb16.i.i ], [ %80, %bb10.i.i ], [ %68, %bb7.i.i ], [ %56, %bb4.i.i ], [ %44, %bb1.i.i ] ; <i32*> [#uses=1] - %tmp2.i.i = ptrtoint i32* %.0.0.i.i to i32 ; <i32> [#uses=1] - %tmp1.i.i = inttoptr i32 %tmp2.i.i to i32* ; <i32*> [#uses=1] - %tmp4.i = ptrtoint i32* %tmp1.i.i to i32 ; <i32> [#uses=1] - %tmp3.i = inttoptr i32 %tmp4.i to i32* ; <i32*> [#uses=1] - %tmp8.i = ptrtoint i32* %tmp3.i to i32 ; <i32> [#uses=1] - %tmp6.i = inttoptr i32 %tmp8.i to i32* ; <i32*> [#uses=1] - %tmp12 = ptrtoint i32* %tmp6.i to i32 ; <i32> [#uses=1] - %tmp10 = inttoptr i32 %tmp12 to i32* ; <i32*> [#uses=1] - %tmp16 = ptrtoint i32* %tmp10 to i32 ; <i32> [#uses=1] - br label %return +_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit: ; preds = %bb26.i.i, %bb24.i.i, %bb20.i.i, %bb16.i.i, %bb10.i.i, %bb7.i.i, %bb4.i.i, %bb1.i.i + %.0.0.i.i = phi i32* [ %132, %bb26.i.i ], [ %126, %bb24.i.i ], [ %114, %bb20.i.i ], [ %102, %bb16.i.i ], [ %80, %bb10.i.i ], [ %68, %bb7.i.i ], [ %56, %bb4.i.i ], [ %44, %bb1.i.i ] + %tmp2.i.i = ptrtoint i32* %.0.0.i.i to i32 + %tmp1.i.i = inttoptr i32 %tmp2.i.i to i32* + %tmp4.i = ptrtoint i32* %tmp1.i.i to i32 + %tmp3.i = inttoptr i32 %tmp4.i to i32* + %tmp8.i = ptrtoint i32* %tmp3.i to i32 + %tmp6.i = inttoptr i32 %tmp8.i to i32* + %tmp12 = ptrtoint i32* %tmp6.i to i32 + %tmp10 = inttoptr i32 %tmp12 to i32* + %tmp16 = ptrtoint i32* %tmp10 to i32 + br label %return -return: ; preds = %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit - %tmp14 = inttoptr i32 %tmp16 to i32* ; <i32*> [#uses=1] - ret i32* %tmp14 +return: ; preds = %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit + %tmp14 = inttoptr i32 %tmp16 to i32* + ret i32* %tmp14 } -declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/2011-02-16-InsertelementHang.ll b/test/Transforms/InstCombine/2011-02-16-InsertelementHang.ll deleted file mode 100644 index 2f6034e..0000000 --- a/test/Transforms/InstCombine/2011-02-16-InsertelementHang.ll +++ /dev/null @@ -1,11 +0,0 @@ -; RUN: opt < %s -instcombine -S | FileCheck %s -; PR9218 - -%vec2x2 = type { <2 x double>, <2 x double> } - -define %vec2x2 @split(double) nounwind alwaysinline { -; CHECK: @split -; CHECK: ret %vec2x2 undef - %vba = insertelement <2 x double> undef, double %0, i32 2 - ret <2 x double> %vba, <2 x double> %vba -} diff --git a/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll b/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll new file mode 100644 index 0000000..2f72b73 --- /dev/null +++ b/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll @@ -0,0 +1,60 @@ +; RUN: opt -S -instcombine < %s | FileCheck %s +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32" +target triple = "i386-apple-darwin10.0.0" + +define void @fu1(i32 %parm) nounwind ssp { + %1 = alloca i32, align 4 + %ptr = alloca double*, align 4 + store i32 %parm, i32* %1, align 4 + store double* null, double** %ptr, align 4 + %2 = load i32* %1, align 4 + %3 = icmp ne i32 %2, 0 + br i1 %3, label %4, label %10 + +; <label>:4 ; preds = %0 + %5 = load i32* %1, align 4 + %6 = mul nsw i32 %5, 8 +; With "nsw", the alloca and its bitcast can be fused: + %7 = add nsw i32 %6, 2048 +; CHECK: alloca double* + %8 = alloca i8, i32 %7 + %9 = bitcast i8* %8 to double* + store double* %9, double** %ptr, align 4 + br label %10 + +; <label>:10 ; preds = %4, %0 + %11 = load double** %ptr, align 4 + call void @bar(double* %11) +; CHECK: ret + ret void +} + +declare void @bar(double*) + +define void @fu2(i32 %parm) nounwind ssp { + %1 = alloca i32, align 4 + %ptr = alloca double*, align 4 + store i32 %parm, i32* %1, align 4 + store double* null, double** %ptr, align 4 + %2 = load i32* %1, align 4 + %3 = icmp ne i32 %2, 0 + br i1 %3, label %4, label %10 + +; <label>:4 ; preds = %0 + %5 = load i32* %1, align 4 + %6 = mul nsw i32 %5, 8 +; Without "nsw", the alloca and its bitcast cannot be fused: + %7 = add i32 %6, 2048 +; CHECK: alloca i8 + %8 = alloca i8, i32 %7 +; CHECK-NEXT: bitcast i8* + %9 = bitcast i8* %8 to double* + store double* %9, double** %ptr, align 4 + br label %10 + +; <label>:10 ; preds = %4, %0 + %11 = load double** %ptr, align 4 + call void @bar(double* %11) + ret void +} + diff --git a/test/Transforms/InstCombine/bswap-fold.ll b/test/Transforms/InstCombine/bswap-fold.ll index a6b30c0..442ce58 100644 --- a/test/Transforms/InstCombine/bswap-fold.ll +++ b/test/Transforms/InstCombine/bswap-fold.ll @@ -50,10 +50,6 @@ entry: } ; PR5284 -declare i64 @llvm.bswap.i64(i64) -declare i32 @llvm.bswap.i32(i32) -declare i16 @llvm.bswap.i16(i16) - define i16 @test7(i32 %A) { %B = tail call i32 @llvm.bswap.i32(i32 %A) nounwind %C = trunc i32 %B to i16 diff --git a/test/Transforms/InstCombine/call2.ll b/test/Transforms/InstCombine/call2.ll index 3a6bd67..1f45c7a 100644 --- a/test/Transforms/InstCombine/call2.ll +++ b/test/Transforms/InstCombine/call2.ll @@ -4,7 +4,6 @@ define i32 @bar() { entry: %retval = alloca i32, align 4 ; <i32*> [#uses=1] - "alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] %tmp = call i32 (...)* bitcast (i32 (i8*)* @f to i32 (...)*)( double 3.000000e+00 ) ; <i32> [#uses=0] br label %return @@ -17,7 +16,6 @@ define i32 @f(i8* %p) { entry: %p_addr = alloca i8* ; <i8**> [#uses=1] %retval = alloca i32, align 4 ; <i32*> [#uses=1] - "alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] store i8* %p, i8** %p_addr br label %return diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll index bc5e365..f85636f 100644 --- a/test/Transforms/InstCombine/cast.ll +++ b/test/Transforms/InstCombine/cast.ll @@ -99,14 +99,6 @@ define void @test11(i32* %P) { ; CHECK: ret void } -define i32* @test12() { - %p = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] - %c = bitcast [4 x i8]* %p to i32* ; <i32*> [#uses=1] - ret i32* %c -; CHECK: %malloccall = tail call i8* @malloc(i32 4) -; CHECK: ret i32* %c -} - define i8* @test13(i64 %A) { %c = getelementptr [0 x i8]* bitcast ([32832 x i8]* @inbuf to [0 x i8]*), i64 0, i64 %A ; <i8*> [#uses=1] ret i8* %c @@ -265,22 +257,11 @@ define i1 @test31(i64 %A) { %C = and i32 %B, 42 ; <i32> [#uses=1] %D = icmp eq i32 %C, 10 ; <i1> [#uses=1] ret i1 %D -; CHECK: %C1 = and i64 %A, 42 -; CHECK: %D = icmp eq i64 %C1, 10 +; CHECK: %C = and i64 %A, 42 +; CHECK: %D = icmp eq i64 %C, 10 ; CHECK: ret i1 %D } -define void @test32(double** %tmp) { - %tmp8 = malloc [16 x i8] ; <[16 x i8]*> [#uses=1] - %tmp8.upgrd.1 = bitcast [16 x i8]* %tmp8 to double* ; <double*> [#uses=1] - store double* %tmp8.upgrd.1, double** %tmp - ret void -; CHECK: %malloccall = tail call i8* @malloc(i32 16) -; CHECK: %tmp8.upgrd.1 = bitcast i8* %malloccall to double* -; CHECK: store double* %tmp8.upgrd.1, double** %tmp -; CHECK: ret void -} - define i32 @test33(i32 %c1) { %x = bitcast i32 %c1 to float ; <float> [#uses=1] %y = bitcast float %x to i32 ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll index 9e8547b..26c0e47 100644 --- a/test/Transforms/InstCombine/getelementptr.ll +++ b/test/Transforms/InstCombine/getelementptr.ll @@ -40,7 +40,7 @@ define i32* @test4({ i32 }* %I) { %B = getelementptr { i32 }* %A, i64 0, i32 0 ret i32* %B ; CHECK: @test4 -; CHECK: getelementptr %intstruct* %I, i64 1, i32 0 +; CHECK: getelementptr { i32 }* %I, i64 1, i32 0 } define void @test5(i8 %B) { @@ -52,14 +52,6 @@ define void @test5(i8 %B) { ; CHECK: store i8 %B, i8* getelementptr inbounds ([10 x i8]* @Global, i64 0, i64 4) } -define i32* @test6() { - %M = malloc [4 x i32] - %A = getelementptr [4 x i32]* %M, i64 0, i64 0 - %B = getelementptr i32* %A, i64 2 - ret i32* %B -; CHECK: @test6 -; CHECK: getelementptr i8* %malloccall, i64 8 -} define i32* @test7(i32* %I, i64 %C, i64 %D) { %A = getelementptr i32* %I, i64 %C @@ -94,7 +86,7 @@ define i1 @test10({ i32, i32 }* %x, { i32, i32 }* %y) { %tmp.4 = icmp eq i32* %tmp.1, %tmp.3 ret i1 %tmp.4 ; CHECK: @test10 -; CHECK: icmp eq %pair* %x, %y +; CHECK: icmp eq { i32, i32 }* %x, %y } define i1 @test11({ i32, i32 }* %X) { @@ -102,7 +94,7 @@ define i1 @test11({ i32, i32 }* %X) { %Q = icmp eq i32* %P, null ret i1 %Q ; CHECK: @test11 -; CHECK: icmp eq %pair* %X, null +; CHECK: icmp eq { i32, i32 }* %X, null } @@ -236,19 +228,6 @@ define i1 @test23() { ; CHECK: ret i1 false } -%"java/lang/Object" = type { %struct.llvm_java_object_base } -%"java/lang/StringBuffer" = type { %"java/lang/Object", i32, { %"java/lang/Object", i32, [0 x i16] }*, i1 } -%struct.llvm_java_object_base = type opaque - -define void @test24() { -bc0: - %tmp53 = getelementptr %"java/lang/StringBuffer"* null, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 0, i32* %tmp53 - ret void -; CHECK: @test24 -; CHECK: store i32 0, i32* getelementptr (%"java/lang/StringBuffer"* null, i64 0, i32 1) -} - define void @test25() { entry: %tmp = getelementptr { i64, i64, i64, i64 }* null, i32 0, i32 3 ; <i64*> [#uses=1] @@ -477,3 +456,19 @@ define i32* @test38(i32* %I, i32 %n) { ; CHECK: = sext i32 %n to i64 ; CHECK: %A = getelementptr i32* %I, i64 % } + +; Test that we don't duplicate work when the second gep is a "bitcast". +%pr10322_t = type { i8* } +declare void @pr10322_f2(%pr10322_t*) +declare void @pr10322_f3(i8**) +define void @pr10322_f1(%pr10322_t* %foo) { +entry: + %arrayidx8 = getelementptr inbounds %pr10322_t* %foo, i64 2 + call void @pr10322_f2(%pr10322_t* %arrayidx8) nounwind + %tmp2 = getelementptr inbounds %pr10322_t* %arrayidx8, i64 0, i32 0 + call void @pr10322_f3(i8** %tmp2) nounwind + ret void + +; CHECK: @pr10322_f1 +; CHECK: %tmp2 = getelementptr inbounds %pr10322_t* %arrayidx8, i64 0, i32 0 +} diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll index 1237ade..77ca62c 100644 --- a/test/Transforms/InstCombine/icmp.ll +++ b/test/Transforms/InstCombine/icmp.ll @@ -521,3 +521,41 @@ define i1 @test53(i32 %a, i32 %b) nounwind { %z = icmp eq i32 %x, %y ret i1 %z } + +; CHECK: @test54 +; CHECK-NEXT: %and = and i8 %a, -64 +; CHECK-NEXT icmp eq i8 %and, -128 +define i1 @test54(i8 %a) nounwind { + %ext = zext i8 %a to i32 + %and = and i32 %ext, 192 + %ret = icmp eq i32 %and, 128 + ret i1 %ret +} + +; CHECK: @test55 +; CHECK-NEXT: icmp eq i32 %a, -123 +define i1 @test55(i32 %a) { + %sub = sub i32 0, %a + %cmp = icmp eq i32 %sub, 123 + ret i1 %cmp +} + +; CHECK: @test56 +; CHECK-NEXT: icmp eq i32 %a, -113 +define i1 @test56(i32 %a) { + %sub = sub i32 10, %a + %cmp = icmp eq i32 %sub, 123 + ret i1 %cmp +} + +; PR10267 Don't make icmps more expensive when no other inst is subsumed. +declare void @foo(i32) +; CHECK: @test57 +; CHECK: %and = and i32 %a, -2 +; CHECK: %cmp = icmp ne i32 %and, 0 +define i1 @test57(i32 %a) { + %and = and i32 %a, -2 + %cmp = icmp ne i32 %and, 0 + call void @foo(i32 %and) + ret i1 %cmp +} diff --git a/test/Transforms/InstCombine/intrinsics.ll b/test/Transforms/InstCombine/intrinsics.ll index 107f313..0d84ae4 100644 --- a/test/Transforms/InstCombine/intrinsics.ll +++ b/test/Transforms/InstCombine/intrinsics.ll @@ -213,5 +213,4 @@ define i32 @cttz_simplify1(i32 %x) nounwind readnone ssp { ; CHECK-NEXT: ret i32 } -declare i32 @llvm.ctlz.i32(i32) nounwind readnone diff --git a/test/Transforms/InstCombine/malloc-free-delete.ll b/test/Transforms/InstCombine/malloc-free-delete.ll index 317786f..8455300 100644 --- a/test/Transforms/InstCombine/malloc-free-delete.ll +++ b/test/Transforms/InstCombine/malloc-free-delete.ll @@ -1,14 +1,14 @@ ; RUN: opt < %s -instcombine -S | FileCheck %s ; PR1201 define i32 @main(i32 %argc, i8** %argv) { - %c_19 = alloca i8* - %malloc_206 = malloc i8, i32 10 + %c_19 = alloca i8* + %malloc_206 = tail call i8* @malloc(i32 mul (i32 ptrtoint (i8* getelementptr (i8* null, i32 1) to i32), i32 10)) + store i8* %malloc_206, i8** %c_19 + %tmp_207 = load i8** %c_19 + tail call void @free(i8* %tmp_207) + ret i32 0 ; CHECK-NOT: malloc - store i8* %malloc_206, i8** %c_19 - %tmp_207 = load i8** %c_19 - free i8* %tmp_207 ; CHECK-NOT: free - ret i32 0 ; CHECK: ret i32 0 } diff --git a/test/Transforms/InstCombine/malloc.ll b/test/Transforms/InstCombine/malloc.ll deleted file mode 100644 index b6ebbea..0000000 --- a/test/Transforms/InstCombine/malloc.ll +++ /dev/null @@ -1,7 +0,0 @@ -; test that malloc's with a constant argument are promoted to array allocations -; RUN: opt < %s -instcombine -S | grep getelementptr - -define i32* @test() { - %X = malloc i32, i32 4 - ret i32* %X -} diff --git a/test/Transforms/InstCombine/malloc2.ll b/test/Transforms/InstCombine/malloc2.ll deleted file mode 100644 index 8462dac..0000000 --- a/test/Transforms/InstCombine/malloc2.ll +++ /dev/null @@ -1,22 +0,0 @@ -; RUN: opt < %s -instcombine -S | FileCheck %s -; PR1313 - -define i32 @test1(i32 %argc, i8* %argv, i8* %envp) { - %tmp15.i.i.i23 = malloc [2564 x i32] ; <[2564 x i32]*> [#uses=1] -; CHECK-NOT: call i8* @malloc - %c = icmp eq [2564 x i32]* %tmp15.i.i.i23, null ; <i1>:0 [#uses=1] - %retval = zext i1 %c to i32 ; <i32> [#uses=1] - ret i32 %retval -; CHECK: ret i32 0 -} - -define i32 @test2(i32 %argc, i8* %argv, i8* %envp) { - %tmp15.i.i.i23 = malloc [2564 x i32] ; <[2564 x i32]*> [#uses=1] -; CHECK-NOT: call i8* @malloc - %X = bitcast [2564 x i32]* %tmp15.i.i.i23 to i32* - %c = icmp ne i32* %X, null - %retval = zext i1 %c to i32 ; <i32> [#uses=1] - ret i32 %retval -; CHECK: ret i32 1 -} - diff --git a/test/Transforms/InstCombine/malloc3.ll b/test/Transforms/InstCombine/malloc3.ll deleted file mode 100644 index f1c0cae..0000000 --- a/test/Transforms/InstCombine/malloc3.ll +++ /dev/null @@ -1,26 +0,0 @@ -; RUN: opt < %s -instcombine -S | not grep load -; PR1728 - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i686-apple-darwin8" - %struct.foo = type { %struct.foo*, [10 x i32] } -@.str = internal constant [21 x i8] c"tmp = %p, next = %p\0A\00" ; <[21 x i8]*> [#uses=1] - -define i32 @main() { -entry: - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - %tmp1 = malloc i8, i32 44 ; <i8*> [#uses=1] - %tmp12 = bitcast i8* %tmp1 to %struct.foo* ; <%struct.foo*> [#uses=3] - %tmp3 = malloc i8, i32 44 ; <i8*> [#uses=1] - %tmp34 = bitcast i8* %tmp3 to %struct.foo* ; <%struct.foo*> [#uses=1] - %tmp6 = getelementptr %struct.foo* %tmp12, i32 0, i32 0 ; <%struct.foo**> [#uses=1] - store %struct.foo* %tmp34, %struct.foo** %tmp6, align 4 - %tmp8 = getelementptr %struct.foo* %tmp12, i32 0, i32 0 ; <%struct.foo**> [#uses=1] - %tmp9 = load %struct.foo** %tmp8, align 4 ; <%struct.foo*> [#uses=1] - %tmp10 = getelementptr [21 x i8]* @.str, i32 0, i32 0 ; <i8*> [#uses=1] - %tmp13 = call i32 (i8*, ...)* @printf( i8* %tmp10, %struct.foo* %tmp12, %struct.foo* %tmp9 ) ; <i32> [#uses=0] - ret i32 undef -} - -declare i32 @printf(i8*, ...) - diff --git a/test/Transforms/InstCombine/memcpy-to-load.ll b/test/Transforms/InstCombine/memcpy-to-load.ll index ebb8711..04aac98 100644 --- a/test/Transforms/InstCombine/memcpy-to-load.ll +++ b/test/Transforms/InstCombine/memcpy-to-load.ll @@ -4,11 +4,10 @@ target triple = "i686-apple-darwin8" define void @foo(double* %X, double* %Y) { entry: - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - %tmp2 = bitcast double* %X to i8* ; <i8*> [#uses=1] - %tmp13 = bitcast double* %Y to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %tmp2, i8* %tmp13, i32 8, i32 1 ) - ret void + %tmp2 = bitcast double* %X to i8* + %tmp13 = bitcast double* %Y to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp2, i8* %tmp13, i32 8, i32 1, i1 false) + ret void } -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/memmove.ll b/test/Transforms/InstCombine/memmove.ll index 1806cfc..4602c12 100644 --- a/test/Transforms/InstCombine/memmove.ll +++ b/test/Transforms/InstCombine/memmove.ll @@ -1,24 +1,20 @@ ; This test makes sure that memmove instructions are properly eliminated. ; -; RUN: opt < %s -instcombine -S | \ -; RUN: not grep {call void @llvm.memmove} +; RUN: opt < %s -instcombine -S | not grep {call void @llvm.memmove} @S = internal constant [33 x i8] c"panic: restorelist inconsistency\00" ; <[33 x i8]*> [#uses=1] @h = constant [2 x i8] c"h\00" ; <[2 x i8]*> [#uses=1] @hel = constant [4 x i8] c"hel\00" ; <[4 x i8]*> [#uses=1] @hello_u = constant [8 x i8] c"hello_u\00" ; <[8 x i8]*> [#uses=1] - -declare void @llvm.memmove.i32(i8*, i8*, i32, i32) - define void @test1(i8* %A, i8* %B, i32 %N) { - call void @llvm.memmove.i32( i8* %A, i8* %B, i32 0, i32 1 ) + call void @llvm.memmove.p0i8.p0i8.i32(i8* %A, i8* %B, i32 0, i32 1, i1 false) ret void } define void @test2(i8* %A, i32 %N) { ;; dest can't alias source since we can't write to source! - call void @llvm.memmove.i32( i8* %A, i8* getelementptr ([33 x i8]* @S, i32 0, i32 0), i32 %N, i32 1 ) + call void @llvm.memmove.p0i8.p0i8.i32(i8* %A, i8* getelementptr inbounds ([33 x i8]* @S, i32 0, i32 0), i32 %N, i32 1, i1 false) ret void } @@ -28,15 +24,16 @@ define i32 @test3() { %hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0 ; <i8*> [#uses=1] %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1] %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=3] - call void @llvm.memmove.i32( i8* %target_p, i8* %h_p, i32 2, i32 2 ) - call void @llvm.memmove.i32( i8* %target_p, i8* %hel_p, i32 4, i32 4 ) - call void @llvm.memmove.i32( i8* %target_p, i8* %hello_u_p, i32 8, i32 8 ) + call void @llvm.memmove.p0i8.p0i8.i32(i8* %target_p, i8* %h_p, i32 2, i32 2, i1 false) + call void @llvm.memmove.p0i8.p0i8.i32(i8* %target_p, i8* %hel_p, i32 4, i32 4, i1 false) + call void @llvm.memmove.p0i8.p0i8.i32(i8* %target_p, i8* %hello_u_p, i32 8, i32 8, i1 false) ret i32 0 } ; PR2370 define void @test4(i8* %a) { - tail call void @llvm.memmove.i32( i8* %a, i8* %a, i32 100, i32 1 ) - ret void + tail call void @llvm.memmove.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i32 1, i1 false) + ret void } +declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/memset.ll b/test/Transforms/InstCombine/memset.ll index 8e85694..7f7bc9f 100644 --- a/test/Transforms/InstCombine/memset.ll +++ b/test/Transforms/InstCombine/memset.ll @@ -1,15 +1,14 @@ ; RUN: opt < %s -instcombine -S | not grep {call.*llvm.memset} -declare void @llvm.memset.i32(i8*, i8, i32, i32) - define i32 @main() { - %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1] - %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=5] - call void @llvm.memset.i32( i8* %target_p, i8 1, i32 0, i32 1 ) - call void @llvm.memset.i32( i8* %target_p, i8 1, i32 1, i32 1 ) - call void @llvm.memset.i32( i8* %target_p, i8 1, i32 2, i32 2 ) - call void @llvm.memset.i32( i8* %target_p, i8 1, i32 4, i32 4 ) - call void @llvm.memset.i32( i8* %target_p, i8 1, i32 8, i32 8 ) - ret i32 0 + %target = alloca [1024 x i8] + %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 + call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 0, i32 1, i1 false) + call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 1, i32 1, i1 false) + call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 2, i32 2, i1 false) + call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 4, i32 4, i1 false) + call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 8, i32 8, i1 false) + ret i32 0 } +declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/not.ll b/test/Transforms/InstCombine/not.ll index c58ce11..4a8825b 100644 --- a/test/Transforms/InstCombine/not.ll +++ b/test/Transforms/InstCombine/not.ll @@ -43,7 +43,7 @@ define i32 @test5(i32 %A, i32 %B) { } ; PR2298 -define i8 @test6(i32 %a, i32 %b) zeroext nounwind { +define zeroext i8 @test6(i32 %a, i32 %b) nounwind { entry: %tmp1not = xor i32 %a, -1 ; <i32> [#uses=1] %tmp2not = xor i32 %b, -1 ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/objsize.ll b/test/Transforms/InstCombine/objsize.ll index 043525b..28ceb68 100644 --- a/test/Transforms/InstCombine/objsize.ll +++ b/test/Transforms/InstCombine/objsize.ll @@ -149,8 +149,6 @@ declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind declare noalias i8* @malloc(i32) nounwind -declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly - define i32 @test7() { ; CHECK: @test7 %alloc = call noalias i8* @malloc(i32 48) nounwind diff --git a/test/Transforms/InstCombine/phi.ll b/test/Transforms/InstCombine/phi.ll index cd865ae..219545c 100644 --- a/test/Transforms/InstCombine/phi.ll +++ b/test/Transforms/InstCombine/phi.ll @@ -139,7 +139,7 @@ BB2: ; CHECK: @test8 ; CHECK-NOT: phi ; CHECK: BB2: -; CHECK-NEXT: %B = getelementptr %0 +; CHECK-NEXT: %B = getelementptr { i32, i32 }* %A ; CHECK-NEXT: ret i32* %B } diff --git a/test/Transforms/InstCombine/select-crash.ll b/test/Transforms/InstCombine/select-crash.ll index 8ee3369..18af152 100644 --- a/test/Transforms/InstCombine/select-crash.ll +++ b/test/Transforms/InstCombine/select-crash.ll @@ -18,3 +18,15 @@ entry: %add94 = fadd double undef, %mul91 ret double %add94 } + +; PR10180: same crash, but with vectors +define <4 x float> @foo(i1 %b, <4 x float> %x, <4 x float> %y, <4 x float> %z) { +; CHECK: @foo +; CHECK: fsub <4 x float> +; CHECK: select +; CHECK: fadd <4 x float> + %a = fadd <4 x float> %x, %y + %sub = fsub <4 x float> %x, %z + %sel = select i1 %b, <4 x float> %a, <4 x float> %sub + ret <4 x float> %sel +} diff --git a/test/Transforms/InstCombine/sqrt.ll b/test/Transforms/InstCombine/sqrt.ll index 69e511b..cc78417 100644 --- a/test/Transforms/InstCombine/sqrt.ll +++ b/test/Transforms/InstCombine/sqrt.ll @@ -14,8 +14,6 @@ entry: ret float %conv1 } -declare double @sqrt(double) - ; PR8096 define float @test2(float %x) nounwind readnone ssp { entry: @@ -30,3 +28,27 @@ entry: ; CHECK: ret float ret float %conv1 } + +; rdar://9763193 +; Can't fold (fptrunc (sqrt (fpext x))) -> (sqrtf x) since there is another +; use of sqrt result. +define float @test3(float* %v) nounwind uwtable ssp { +entry: +; CHECK: @test3 +; CHECK: sqrt( +; CHECK-NOT: sqrtf( +; CHECK: fptrunc + %arrayidx13 = getelementptr inbounds float* %v, i64 2 + %tmp14 = load float* %arrayidx13 + %mul18 = fmul float %tmp14, %tmp14 + %add19 = fadd float undef, %mul18 + %conv = fpext float %add19 to double + %call34 = call double @sqrt(double %conv) readnone + %call36 = call i32 (double)* @foo(double %call34) nounwind + %conv38 = fptrunc double %call34 to float + ret float %conv38 +} + +declare i32 @foo(double) + +declare double @sqrt(double) readnone diff --git a/test/Transforms/InstCombine/stack-overalign.ll b/test/Transforms/InstCombine/stack-overalign.ll index 88b4114..2fc8414 100644 --- a/test/Transforms/InstCombine/stack-overalign.ll +++ b/test/Transforms/InstCombine/stack-overalign.ll @@ -17,13 +17,13 @@ define void @foo() nounwind { entry: - %src = alloca [1024 x i8], align 1 - %src1 = getelementptr [1024 x i8]* %src, i32 0, i32 0 - call void @llvm.memcpy.i32(i8* getelementptr ([1024 x i8]* @dst, i32 0, i32 0), i8* %src1, i32 1024, i32 1) - call void @frob(i8* %src1) nounwind - ret void + %src = alloca [1024 x i8], align 1 + %src1 = getelementptr [1024 x i8]* %src, i32 0, i32 0 + call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([1024 x i8]* @dst, i32 0, i32 0), i8* %src1, i32 1024, i32 1, i1 false) + call void @frob(i8* %src1) nounwind + ret void } -declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind - declare void @frob(i8*) + +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/sub.ll b/test/Transforms/InstCombine/sub.ll index 9656a7e..37de328 100644 --- a/test/Transforms/InstCombine/sub.ll +++ b/test/Transforms/InstCombine/sub.ll @@ -203,7 +203,7 @@ define i1 @test21(i32 %g, i32 %h) { } ; PR2298 -define i1 @test22(i32 %a, i32 %b) zeroext nounwind { +define zeroext i1 @test22(i32 %a, i32 %b) nounwind { %tmp2 = sub i32 0, %a %tmp4 = sub i32 0, %b %tmp5 = icmp eq i32 %tmp2, %tmp4 diff --git a/test/Transforms/InstCombine/vec_narrow.ll b/test/Transforms/InstCombine/vec_narrow.ll index c05c802..2be43599 100644 --- a/test/Transforms/InstCombine/vec_narrow.ll +++ b/test/Transforms/InstCombine/vec_narrow.ll @@ -1,12 +1,10 @@ -; RUN: opt < %s -instcombine -S | \ -; RUN: grep {fadd float} +; RUN: opt < %s -instcombine -S | grep {fadd float} - %V = type <4 x float> -define float @test(%V %A, %V %B, float %f) { - %C = insertelement %V %A, float %f, i32 0 ; <%V> [#uses=1] - %D = fadd %V %C, %B ; <%V> [#uses=1] - %E = extractelement %V %D, i32 0 ; <float> [#uses=1] +define float @test(<4 x float> %A, <4 x float> %B, float %f) { + %C = insertelement <4 x float> %A, float %f, i32 0 ; <%V> [#uses=1] + %D = fadd <4 x float> %C, %B ; <%V> [#uses=1] + %E = extractelement <4 x float> %D, i32 0 ; <float> [#uses=1] ret float %E } diff --git a/test/Transforms/InstCombine/vec_shuffle.ll b/test/Transforms/InstCombine/vec_shuffle.ll index bd36e9e..896cb88 100644 --- a/test/Transforms/InstCombine/vec_shuffle.ll +++ b/test/Transforms/InstCombine/vec_shuffle.ll @@ -1,28 +1,25 @@ ; RUN: opt < %s -instcombine -S | FileCheck %s -%T = type <4 x float> - - -define %T @test1(%T %v1) { +define <4 x float> @test1(<4 x float> %v1) { ; CHECK: @test1 -; CHECK: ret %T %v1 - %v2 = shufflevector %T %v1, %T undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3> - ret %T %v2 +; CHECK: ret <4 x float> %v1 + %v2 = shufflevector <4 x float> %v1, <4 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3> + ret <4 x float> %v2 } -define %T @test2(%T %v1) { +define <4 x float> @test2(<4 x float> %v1) { ; CHECK: @test2 -; CHECK: ret %T %v1 - %v2 = shufflevector %T %v1, %T %v1, <4 x i32> <i32 0, i32 5, i32 2, i32 7> - ret %T %v2 +; CHECK: ret <4 x float> %v1 + %v2 = shufflevector <4 x float> %v1, <4 x float> %v1, <4 x i32> <i32 0, i32 5, i32 2, i32 7> + ret <4 x float> %v2 } -define float @test3(%T %A, %T %B, float %f) { +define float @test3(<4 x float> %A, <4 x float> %B, float %f) { ; CHECK: @test3 ; CHECK: ret float %f - %C = insertelement %T %A, float %f, i32 0 - %D = shufflevector %T %C, %T %B, <4 x i32> <i32 5, i32 0, i32 2, i32 7> - %E = extractelement %T %D, i32 1 + %C = insertelement <4 x float> %A, float %f, i32 0 + %D = shufflevector <4 x float> %C, <4 x float> %B, <4 x i32> <i32 5, i32 0, i32 2, i32 7> + %E = extractelement <4 x float> %D, i32 1 ret float %E } @@ -57,7 +54,7 @@ define float @test6(<4 x float> %X) { define <4 x float> @test7(<4 x float> %tmp45.i) { ; CHECK: @test7 -; CHECK-NEXT: ret %T %tmp45.i +; CHECK-NEXT: ret <4 x float> %tmp45.i %tmp1642.i = shufflevector <4 x float> %tmp45.i, <4 x float> undef, <4 x i32> < i32 0, i32 1, i32 6, i32 7 > ret <4 x float> %tmp1642.i } diff --git a/test/Transforms/InstCombine/zext-or-icmp.ll b/test/Transforms/InstCombine/zext-or-icmp.ll index 969c301..ddc6083 100644 --- a/test/Transforms/InstCombine/zext-or-icmp.ll +++ b/test/Transforms/InstCombine/zext-or-icmp.ll @@ -4,7 +4,7 @@ %struct.Rock = type { i16, i16 } @some_idx = internal constant [4 x i8] c"\0A\0B\0E\0F" ; <[4 x i8]*> [#uses=1] -define i8 @t(%struct.FooBar* %up, i8 zeroext %intra_flag, i32 %blk_i) zeroext nounwind { +define zeroext i8 @t(%struct.FooBar* %up, i8 zeroext %intra_flag, i32 %blk_i) nounwind { entry: %tmp2 = lshr i32 %blk_i, 1 ; <i32> [#uses=1] %tmp3 = and i32 %tmp2, 2 ; <i32> [#uses=1] |