From a2f9098f7ab67f44246b412771b0003901138b5d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 19 Sep 2020 20:54:20 +0200 Subject: [PATCH] [InstCombine] Regenerate test checks (NFC) --- .../InstCombine/2009-01-08-AlignAlloca.ll | 48 +++-- llvm/test/Transforms/InstCombine/align-2d-gep.ll | 27 ++- .../InstCombine/alloca-cast-debuginfo.ll | 23 +-- llvm/test/Transforms/InstCombine/alloca.ll | 200 +++++++++++++++------ .../Transforms/InstCombine/assume-loop-align.ll | 30 +++- .../constant-fold-address-space-pointer.ll | 101 +++++++---- .../Transforms/InstCombine/constant-fold-gep.ll | 56 +++--- llvm/test/Transforms/InstCombine/gep-custom-dl.ll | 8 +- llvm/test/Transforms/InstCombine/getelementptr.ll | 14 +- .../Transforms/InstCombine/loadstore-alignment.ll | 76 +++++--- .../Transforms/InstCombine/memcpy-from-global.ll | 16 +- 11 files changed, 413 insertions(+), 186 deletions(-) diff --git a/llvm/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll b/llvm/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll index 9994b58..f6d0c4e 100644 --- a/llvm/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll +++ b/llvm/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll @@ -1,6 +1,6 @@ -; RUN: opt < %s -instcombine -S > %t -; RUN: grep ", align 4" %t | count 3 -; RUN: grep ", align 8" %t | count 3 +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -instcombine -S | FileCheck %s + ; rdar://6480438 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" @@ -8,21 +8,35 @@ target triple = "i386-apple-darwin9.6" %struct.anon = type <{ i8, [3 x i8], i32 }> define i32 @bar(i64 %key_token2) nounwind { +; CHECK-LABEL: @bar( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[IOSPEC:%.*]] = alloca [[STRUCT_KEY:%.*]], align 8 +; CHECK-NEXT: [[RET:%.*]] = alloca i32, align 4 +; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_KEY]], %struct.Key* [[IOSPEC]], i32 0, i32 0, i32 0 +; CHECK-NEXT: store i32 0, i32* [[TMP0]], align 8 +; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_KEY]], %struct.Key* [[IOSPEC]], i32 0, i32 0, i32 1 +; CHECK-NEXT: store i32 0, i32* [[TMP1]], align 4 +; CHECK-NEXT: [[TMP2:%.*]] = bitcast %struct.Key* [[IOSPEC]] to i64* +; CHECK-NEXT: store i64 [[KEY_TOKEN2:%.*]], i64* [[TMP2]], align 8 +; CHECK-NEXT: [[TMP3:%.*]] = call i32 (...) @foo(%struct.Key* nonnull byval align 4 [[IOSPEC]], i32* nonnull [[RET]]) [[ATTR0:#.*]] +; CHECK-NEXT: [[TMP4:%.*]] = load i32, i32* [[RET]], align 4 +; CHECK-NEXT: ret i32 [[TMP4]] +; entry: - %iospec = alloca %struct.Key ; <%struct.Key*> [#uses=3] - %ret = alloca i32 ; [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - %0 = getelementptr %struct.Key, %struct.Key* %iospec, i32 0, i32 0 ; <{ i32, i32 }*> [#uses=2] - %1 = getelementptr { i32, i32 }, { i32, i32 }* %0, i32 0, i32 0 ; [#uses=1] - store i32 0, i32* %1, align 4 - %2 = getelementptr { i32, i32 }, { i32, i32 }* %0, i32 0, i32 1 ; [#uses=1] - store i32 0, i32* %2, align 4 - %3 = getelementptr %struct.Key, %struct.Key* %iospec, i32 0, i32 0 ; <{ i32, i32 }*> [#uses=1] - %4 = bitcast { i32, i32 }* %3 to i64* ; [#uses=1] - store i64 %key_token2, i64* %4, align 4 - %5 = call i32 (...) @foo(%struct.Key* byval align 4 %iospec, i32* %ret) nounwind ; [#uses=0] - %6 = load i32, i32* %ret, align 4 ; [#uses=1] - ret i32 %6 + %iospec = alloca %struct.Key ; <%struct.Key*> [#uses=3] + %ret = alloca i32 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + %0 = getelementptr %struct.Key, %struct.Key* %iospec, i32 0, i32 0 ; <{ i32, i32 }*> [#uses=2] + %1 = getelementptr { i32, i32 }, { i32, i32 }* %0, i32 0, i32 0 ; [#uses=1] + store i32 0, i32* %1, align 4 + %2 = getelementptr { i32, i32 }, { i32, i32 }* %0, i32 0, i32 1 ; [#uses=1] + store i32 0, i32* %2, align 4 + %3 = getelementptr %struct.Key, %struct.Key* %iospec, i32 0, i32 0 ; <{ i32, i32 }*> [#uses=1] + %4 = bitcast { i32, i32 }* %3 to i64* ; [#uses=1] + store i64 %key_token2, i64* %4, align 4 + %5 = call i32 (...) @foo(%struct.Key* byval align 4 %iospec, i32* %ret) nounwind ; [#uses=0] + %6 = load i32, i32* %ret, align 4 ; [#uses=1] + ret i32 %6 } declare i32 @foo(...) diff --git a/llvm/test/Transforms/InstCombine/align-2d-gep.ll b/llvm/test/Transforms/InstCombine/align-2d-gep.ll index bbdb3f9..d7da479 100644 --- a/llvm/test/Transforms/InstCombine/align-2d-gep.ll +++ b/llvm/test/Transforms/InstCombine/align-2d-gep.ll @@ -1,4 +1,5 @@ -; RUN: opt < %s -instcombine -S | grep "align 16" | count 1 +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -instcombine -S | FileCheck %s target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" ; A multi-dimensional array in a nested loop doing vector stores that @@ -12,6 +13,30 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1 @Awkward = global [1001 x [20001 x double]] zeroinitializer, align 32 define void @foo() nounwind { +; CHECK-LABEL: @foo( +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[BB7_OUTER:%.*]] +; CHECK: bb7.outer: +; CHECK-NEXT: [[I:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVAR_NEXT26:%.*]], [[BB11:%.*]] ] +; CHECK-NEXT: br label [[BB1:%.*]] +; CHECK: bb1: +; CHECK-NEXT: [[J:%.*]] = phi i64 [ 0, [[BB7_OUTER]] ], [ [[INDVAR_NEXT:%.*]], [[BB1]] ] +; CHECK-NEXT: [[T4:%.*]] = getelementptr [1001 x [20000 x double]], [1001 x [20000 x double]]* @Nice, i64 0, i64 [[I]], i64 [[J]] +; CHECK-NEXT: [[Q:%.*]] = bitcast double* [[T4]] to <2 x double>* +; CHECK-NEXT: store <2 x double> zeroinitializer, <2 x double>* [[Q]], align 16 +; CHECK-NEXT: [[S4:%.*]] = getelementptr [1001 x [20001 x double]], [1001 x [20001 x double]]* @Awkward, i64 0, i64 [[I]], i64 [[J]] +; CHECK-NEXT: [[R:%.*]] = bitcast double* [[S4]] to <2 x double>* +; CHECK-NEXT: store <2 x double> zeroinitializer, <2 x double>* [[R]], align 8 +; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[J]], 2 +; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVAR_NEXT]], 556 +; CHECK-NEXT: br i1 [[EXITCOND]], label [[BB11]], label [[BB1]] +; CHECK: bb11: +; CHECK-NEXT: [[INDVAR_NEXT26]] = add i64 [[I]], 1 +; CHECK-NEXT: [[EXITCOND27:%.*]] = icmp eq i64 [[INDVAR_NEXT26]], 991 +; CHECK-NEXT: br i1 [[EXITCOND27]], label [[RETURN_SPLIT:%.*]], label [[BB7_OUTER]] +; CHECK: return.split: +; CHECK-NEXT: ret void +; entry: br label %bb7.outer diff --git a/llvm/test/Transforms/InstCombine/alloca-cast-debuginfo.ll b/llvm/test/Transforms/InstCombine/alloca-cast-debuginfo.ll index c3bca70..46419d3 100644 --- a/llvm/test/Transforms/InstCombine/alloca-cast-debuginfo.ll +++ b/llvm/test/Transforms/InstCombine/alloca-cast-debuginfo.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -S -instcombine -instcombine-lower-dbg-declare=0 | FileCheck %s ; In this example, instcombine wants to turn "local" into an i64, since that's @@ -23,6 +24,17 @@ target triple = "x86_64-pc-windows-msvc19.11.25508" %struct.Foo = type { i32, i32 } define void @f(%struct.Foo* %p) !dbg !11 { +; CHECK-LABEL: @f( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[LOCAL:%.*]] = alloca i64, align 8 +; CHECK-NEXT: call void @llvm.dbg.declare(metadata i64* [[LOCAL]], [[META22:metadata !.*]], metadata !DIExpression()), [[DBG23:!dbg !.*]] +; CHECK-NEXT: [[TMP0:%.*]] = bitcast %struct.Foo* [[P:%.*]] to i64*, [[DBG24:!dbg !.*]] +; CHECK-NEXT: [[TMP1:%.*]] = load i64, i64* [[TMP0]], align 8, [[DBG24]], [[TBAA25:!tbaa !.*]] +; CHECK-NEXT: store i64 [[TMP1]], i64* [[LOCAL]], align 8, [[DBG29:!dbg !.*]], [[TBAA25]] +; CHECK-NEXT: [[TMP2:%.*]] = bitcast i64* [[LOCAL]] to i8*, [[DBG30:!dbg !.*]] +; CHECK-NEXT: call void @escape(i8* nonnull [[TMP2]]), [[DBG31:!dbg !.*]] +; CHECK-NEXT: ret void, [[DBG32:!dbg !.*]] +; entry: %local = alloca %struct.Foo, align 4 %0 = bitcast %struct.Foo* %local to i8*, !dbg !24 @@ -37,17 +49,6 @@ entry: ret void, !dbg !35 } -; CHECK-LABEL: define void @f(%struct.Foo* %p) -; CHECK: %local = alloca i64, align 8 -; CHECK: call void @llvm.dbg.declare(metadata i64* %local, metadata !22, metadata !DIExpression()) -; CHECK: [[simplified:%.*]] = bitcast i64* %local to i8* -; -; Another dbg.value for "local" would be redundant here. -; CHECK-NOT: call void @llvm.dbg.value(metadata i8* [[simplified]], metadata !22, metadata !DIExpression()) -; -; CHECK: call void @escape(i8* nonnull [[simplified]]) -; CHECK: ret void - declare void @llvm.dbg.declare(metadata, metadata, metadata) declare void @escape(i8*) diff --git a/llvm/test/Transforms/InstCombine/alloca.ll b/llvm/test/Transforms/InstCombine/alloca.ll index c1ec9b3..072d5f2 100644 --- a/llvm/test/Transforms/InstCombine/alloca.ll +++ b/llvm/test/Transforms/InstCombine/alloca.ll @@ -1,52 +1,89 @@ -; RUN: opt < %s -instcombine -S -data-layout="E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" | FileCheck %s -check-prefix=CHECK -check-prefix=ALL -; RUN: opt < %s -instcombine -S -data-layout="E-p:32:32:32-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" | FileCheck %s -check-prefix=P32 -check-prefix=ALL -; RUN: opt < %s -instcombine -S | FileCheck %s -check-prefix=NODL -check-prefix=ALL - +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -instcombine -S -data-layout="E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" | FileCheck %s -check-prefixes=ALL,CHECK +; RUN: opt < %s -instcombine -S -data-layout="E-p:32:32:32-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" | FileCheck %s -check-prefixes=ALL,P32 +; RUN: opt < %s -instcombine -S | FileCheck %s -check-prefixes=ALL,NODL declare void @use(...) @int = global i32 zeroinitializer ; Zero byte allocas should be merged if they can't be deleted. -; CHECK-LABEL: @test( -; CHECK: alloca -; CHECK-NOT: alloca define void @test() { - %X = alloca [0 x i32] ; <[0 x i32]*> [#uses=1] - call void (...) @use( [0 x i32]* %X ) - %Y = alloca i32, i32 0 ; [#uses=1] - call void (...) @use( i32* %Y ) - %Z = alloca { } ; <{ }*> [#uses=1] - call void (...) @use( { }* %Z ) - %size = load i32, i32* @int - %A = alloca {{}}, i32 %size - call void (...) @use( {{}}* %A ) - ret void +; CHECK-LABEL: @test( +; CHECK-NEXT: [[X:%.*]] = alloca [0 x i32], align 4 +; CHECK-NEXT: call void (...) @use([0 x i32]* nonnull [[X]]) +; CHECK-NEXT: [[Y1_SUB:%.*]] = getelementptr inbounds [0 x i32], [0 x i32]* [[X]], i64 0, i64 0 +; CHECK-NEXT: call void (...) @use(i32* nonnull [[Y1_SUB]]) +; CHECK-NEXT: call void (...) @use([0 x i32]* nonnull [[X]]) +; CHECK-NEXT: call void (...) @use([0 x i32]* nonnull [[X]]) +; CHECK-NEXT: ret void +; +; P32-LABEL: @test( +; P32-NEXT: [[X:%.*]] = alloca [0 x i32], align 4 +; P32-NEXT: call void (...) @use([0 x i32]* nonnull [[X]]) +; P32-NEXT: [[Y1_SUB:%.*]] = getelementptr inbounds [0 x i32], [0 x i32]* [[X]], i32 0, i32 0 +; P32-NEXT: call void (...) @use(i32* nonnull [[Y1_SUB]]) +; P32-NEXT: call void (...) @use([0 x i32]* nonnull [[X]]) +; P32-NEXT: call void (...) @use([0 x i32]* nonnull [[X]]) +; P32-NEXT: ret void +; +; NODL-LABEL: @test( +; NODL-NEXT: [[X:%.*]] = alloca [0 x i32], align 8 +; NODL-NEXT: call void (...) @use([0 x i32]* nonnull [[X]]) +; NODL-NEXT: [[Y1_SUB:%.*]] = getelementptr inbounds [0 x i32], [0 x i32]* [[X]], i64 0, i64 0 +; NODL-NEXT: call void (...) @use(i32* nonnull [[Y1_SUB]]) +; NODL-NEXT: call void (...) @use([0 x i32]* nonnull [[X]]) +; NODL-NEXT: call void (...) @use([0 x i32]* nonnull [[X]]) +; NODL-NEXT: ret void +; + %X = alloca [0 x i32] ; <[0 x i32]*> [#uses=1] + call void (...) @use( [0 x i32]* %X ) + %Y = alloca i32, i32 0 ; [#uses=1] + call void (...) @use( i32* %Y ) + %Z = alloca { } ; <{ }*> [#uses=1] + call void (...) @use( { }* %Z ) + %size = load i32, i32* @int + %A = alloca {{}}, i32 %size + call void (...) @use( {{}}* %A ) + ret void } ; Zero byte allocas should be deleted. -; CHECK-LABEL: @test2( -; CHECK-NOT: alloca define void @test2() { - %A = alloca i32 ; [#uses=1] - store i32 123, i32* %A - ret void +; ALL-LABEL: @test2( +; ALL-NEXT: ret void +; + %A = alloca i32 ; [#uses=1] + store i32 123, i32* %A + ret void } ; Zero byte allocas should be deleted. -; CHECK-LABEL: @test3( -; CHECK-NOT: alloca define void @test3() { - %A = alloca { i32 } ; <{ i32 }*> [#uses=1] - %B = getelementptr { i32 }, { i32 }* %A, i32 0, i32 0 ; [#uses=1] - store i32 123, i32* %B - ret void +; ALL-LABEL: @test3( +; ALL-NEXT: ret void +; + %A = alloca { i32 } ; <{ i32 }*> [#uses=1] + %B = getelementptr { i32 }, { i32 }* %A, i32 0, i32 0 ; [#uses=1] + store i32 123, i32* %B + ret void } -; CHECK-LABEL: @test4( -; CHECK: = zext i32 %n to i64 -; CHECK: %A = alloca i32, i64 % define i32* @test4(i32 %n) { +; CHECK-LABEL: @test4( +; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[N:%.*]] to i64 +; CHECK-NEXT: [[A:%.*]] = alloca i32, i64 [[TMP1]], align 4 +; CHECK-NEXT: ret i32* [[A]] +; +; P32-LABEL: @test4( +; P32-NEXT: [[A:%.*]] = alloca i32, i32 [[N:%.*]], align 4 +; P32-NEXT: ret i32* [[A]] +; +; NODL-LABEL: @test4( +; NODL-NEXT: [[TMP1:%.*]] = zext i32 [[N:%.*]] to i64 +; NODL-NEXT: [[A:%.*]] = alloca i32, i64 [[TMP1]], align 4 +; NODL-NEXT: ret i32* [[A]] +; %A = alloca i32, i32 %n ret i32* %A } @@ -54,10 +91,10 @@ define i32* @test4(i32 %n) { ; Allocas which are only used by GEPs, bitcasts, addrspacecasts, and stores ; (transitively) should be deleted. define void @test5() { -; CHECK-LABEL: @test5( -; CHECK-NOT: alloca -; CHECK-NOT: store -; CHECK: ret +; ALL-LABEL: @test5( +; ALL-NEXT: entry: +; ALL-NEXT: ret void +; entry: %a = alloca { i32 } @@ -84,10 +121,32 @@ declare void @f(i32* %p) ; Check that we don't delete allocas in some erroneous cases. define void @test6() { ; CHECK-LABEL: @test6( -; CHECK-NOT: ret -; CHECK: alloca -; CHECK-NEXT: alloca -; CHECK: ret +; CHECK-NEXT: entry: +; CHECK-NEXT: [[A:%.*]] = alloca { i32 }, align 4 +; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4 +; CHECK-NEXT: [[A_1:%.*]] = getelementptr inbounds { i32 }, { i32 }* [[A]], i64 0, i32 0 +; CHECK-NEXT: store volatile i32 123, i32* [[A_1]], align 4 +; CHECK-NEXT: tail call void @f(i32* nonnull [[B]]) +; CHECK-NEXT: ret void +; +; P32-LABEL: @test6( +; P32-NEXT: entry: +; P32-NEXT: [[A:%.*]] = alloca { i32 }, align 4 +; P32-NEXT: [[B:%.*]] = alloca i32, align 4 +; P32-NEXT: [[A_1:%.*]] = getelementptr inbounds { i32 }, { i32 }* [[A]], i32 0, i32 0 +; P32-NEXT: store volatile i32 123, i32* [[A_1]], align 4 +; P32-NEXT: tail call void @f(i32* nonnull [[B]]) +; P32-NEXT: ret void +; +; NODL-LABEL: @test6( +; NODL-NEXT: entry: +; NODL-NEXT: [[A:%.*]] = alloca { i32 }, align 8 +; NODL-NEXT: [[B:%.*]] = alloca i32, align 4 +; NODL-NEXT: [[A_1:%.*]] = getelementptr inbounds { i32 }, { i32 }* [[A]], i64 0, i32 0 +; NODL-NEXT: store volatile i32 123, i32* [[A_1]], align 8 +; NODL-NEXT: tail call void @f(i32* nonnull [[B]]) +; NODL-NEXT: ret void +; entry: %a = alloca { i32 } @@ -105,6 +164,10 @@ entry: @opaque_global = external constant %opaque_type, align 4 define void @test7() { +; ALL-LABEL: @test7( +; ALL-NEXT: entry: +; ALL-NEXT: ret void +; entry: %0 = alloca %real_type, align 4 %1 = bitcast %real_type* %0 to i8* @@ -118,16 +181,25 @@ declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) n ; Check that the GEP indices use the pointer size, or 64 if unknown define void @test8() { ; CHECK-LABEL: @test8( -; CHECK: alloca [100 x i32] -; CHECK: getelementptr inbounds [100 x i32], [100 x i32]* %x1, i64 0, i64 0 - +; CHECK-NEXT: [[X1:%.*]] = alloca [100 x i32], align 4 +; CHECK-NEXT: [[X1_SUB:%.*]] = getelementptr inbounds [100 x i32], [100 x i32]* [[X1]], i64 0, i64 0 +; CHECK-NEXT: call void (...) @use(i32* nonnull [[X1_SUB]]) +; CHECK-NEXT: ret void +; ; P32-LABEL: @test8( -; P32: alloca [100 x i32] -; P32: getelementptr inbounds [100 x i32], [100 x i32]* %x1, i32 0, i32 0 - +; P32-NEXT: [[X1:%.*]] = alloca [100 x i32], align 4 +; P32-NEXT: [[X1_SUB:%.*]] = getelementptr inbounds [100 x i32], [100 x i32]* [[X1]], i32 0, i32 0 +; P32-NEXT: call void (...) @use(i32* nonnull [[X1_SUB]]) +; P32-NEXT: ret void +; ; NODL-LABEL: @test8( -; NODL: alloca [100 x i32] -; NODL: getelementptr inbounds [100 x i32], [100 x i32]* %x1, i64 0, i64 0 +; NODL-NEXT: [[X1:%.*]] = alloca [100 x i32], align 4 +; NODL-NEXT: [[X1_SUB:%.*]] = getelementptr inbounds [100 x i32], [100 x i32]* [[X1]], i64 0, i64 0 +; NODL-NEXT: call void (...) @use(i32* nonnull [[X1_SUB]]) +; NODL-NEXT: ret void +; + + %x = alloca i32, i32 100 call void (...) @use(i32* %x) ret void @@ -140,11 +212,19 @@ declare i8* @llvm.stacksave() declare void @llvm.stackrestore(i8*) define void @test9(%struct_type* %a) { -; CHECK-LABEL: @test9( +; ALL-LABEL: @test9( +; ALL-NEXT: entry: +; ALL-NEXT: [[ARGMEM:%.*]] = alloca inalloca i64, align 8 +; ALL-NEXT: [[TMPCAST:%.*]] = bitcast i64* [[ARGMEM]] to <{ [[STRUCT_TYPE:%.*]] }>* +; ALL-NEXT: [[TMP0:%.*]] = bitcast %struct_type* [[A:%.*]] to i64* +; ALL-NEXT: [[TMP1:%.*]] = load i64, i64* [[TMP0]], align 4 +; ALL-NEXT: store i64 [[TMP1]], i64* [[ARGMEM]], align 8 +; ALL-NEXT: call void @test9_aux(<{ [[STRUCT_TYPE]] }>* inalloca nonnull [[TMPCAST]]) +; ALL-NEXT: ret void +; entry: %inalloca.save = call i8* @llvm.stacksave() %argmem = alloca inalloca <{ %struct_type }> -; CHECK: alloca inalloca i64, align 8 %0 = getelementptr inbounds <{ %struct_type }>, <{ %struct_type }>* %argmem, i32 0, i32 0 %1 = bitcast %struct_type* %0 to i8* %2 = bitcast %struct_type* %a to i8* @@ -155,11 +235,15 @@ entry: } define void @test10() { -entry: ; ALL-LABEL: @test10( -; ALL: %v32 = alloca i1, align 8 -; ALL: %v64 = alloca i1, align 8 -; ALL: %v33 = alloca i1, align 8 +; ALL-NEXT: entry: +; ALL-NEXT: [[V32:%.*]] = alloca i1, align 8 +; ALL-NEXT: [[V64:%.*]] = alloca i1, align 8 +; ALL-NEXT: [[V33:%.*]] = alloca i1, align 8 +; ALL-NEXT: call void (...) @use(i1* nonnull [[V32]], i1* nonnull [[V64]], i1* nonnull [[V33]]) +; ALL-NEXT: ret void +; +entry: %v32 = alloca i1, align 8 %v64 = alloca i1, i64 1, align 8 %v33 = alloca i1, i33 1, align 8 @@ -168,11 +252,13 @@ entry: } define void @test11() { -entry: ; ALL-LABEL: @test11( -; ALL: %y = alloca i32 -; ALL: call void (...) @use(i32* nonnull @int) [ "blah"(i32* %y) ] -; ALL: ret void +; ALL-NEXT: entry: +; ALL-NEXT: [[Y:%.*]] = alloca i32, align 4 +; ALL-NEXT: call void (...) @use(i32* nonnull @int) [ "blah"(i32* [[Y]]) ] +; ALL-NEXT: ret void +; +entry: %y = alloca i32 call void (...) @use(i32* nonnull @int) [ "blah"(i32* %y) ] ret void diff --git a/llvm/test/Transforms/InstCombine/assume-loop-align.ll b/llvm/test/Transforms/InstCombine/assume-loop-align.ll index e803ba6..55b17ad 100644 --- a/llvm/test/Transforms/InstCombine/assume-loop-align.ll +++ b/llvm/test/Transforms/InstCombine/assume-loop-align.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -domtree -instcombine -loops -S < %s | FileCheck %s ; Note: The -loops above can be anything that requires the domtree, and is ; necessary to work around a pass-manager bug. @@ -7,6 +8,31 @@ target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: nounwind uwtable define void @foo(i32* %a, i32* %b) #0 { +; CHECK-LABEL: @foo( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[PTRINT:%.*]] = ptrtoint i32* [[A:%.*]] to i64 +; CHECK-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], 63 +; CHECK-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0 +; CHECK-NEXT: tail call void @llvm.assume(i1 [[MASKCOND]]) +; CHECK-NEXT: [[PTRINT1:%.*]] = ptrtoint i32* [[B:%.*]] to i64 +; CHECK-NEXT: [[MASKEDPTR2:%.*]] = and i64 [[PTRINT1]], 63 +; CHECK-NEXT: [[MASKCOND3:%.*]] = icmp eq i64 [[MASKEDPTR2]], 0 +; CHECK-NEXT: tail call void @llvm.assume(i1 [[MASKCOND3]]) +; CHECK-NEXT: br label [[FOR_BODY:%.*]] +; CHECK: for.body: +; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] +; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[B]], i64 [[INDVARS_IV]] +; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[ARRAYIDX]], align 64 +; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], 1 +; CHECK-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds i32, i32* [[A]], i64 [[INDVARS_IV]] +; CHECK-NEXT: store i32 [[ADD]], i32* [[ARRAYIDX5]], align 64 +; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 16 +; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[INDVARS_IV_NEXT]] to i32 +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[TMP1]], 1648 +; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]] +; CHECK: for.end: +; CHECK-NEXT: ret void +; entry: %ptrint = ptrtoint i32* %a to i64 %maskedptr = and i64 %ptrint, 63 @@ -18,10 +44,6 @@ entry: tail call void @llvm.assume(i1 %maskcond3) br label %for.body -; CHECK-LABEL: @foo -; CHECK: load i32, i32* {{.*}} align 64 -; CHECK: store i32 {{.*}} align 64 -; CHECK: ret for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] diff --git a/llvm/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll b/llvm/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll index b879b1a..5a28354 100644 --- a/llvm/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll +++ b/llvm/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -S -instcombine %s -o - | FileCheck %s target datalayout = "e-p:32:32:32-p1:64:64:64-p2:8:8:8-p3:16:16:16-p4:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32" @@ -16,7 +17,8 @@ target datalayout = "e-p:32:32:32-p1:64:64:64-p2:8:8:8-p3:16:16:16-p4:16:16:16-i ; The intermediate integer size is the same as the pointer size define i32 addrspace(3)* @test_constant_fold_inttoptr_as_pointer_same_size() { ; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_same_size( -; CHECK-NEXT: ret i32 addrspace(3)* @const_zero_i32_as3 +; CHECK-NEXT: ret i32 addrspace(3)* @const_zero_i32_as3 +; %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i32 %y = inttoptr i32 %x to i32 addrspace(3)* ret i32 addrspace(3)* %y @@ -25,7 +27,8 @@ define i32 addrspace(3)* @test_constant_fold_inttoptr_as_pointer_same_size() { ; The intermediate integer size is larger than the pointer size define i32 addrspace(2)* @test_constant_fold_inttoptr_as_pointer_smaller() { ; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_smaller( -; CHECK-NEXT: ret i32 addrspace(2)* @const_zero_i32_as2 +; CHECK-NEXT: ret i32 addrspace(2)* @const_zero_i32_as2 +; %x = ptrtoint i32 addrspace(2)* @const_zero_i32_as2 to i16 %y = inttoptr i16 %x to i32 addrspace(2)* ret i32 addrspace(2)* %y @@ -35,7 +38,8 @@ define i32 addrspace(2)* @test_constant_fold_inttoptr_as_pointer_smaller() { ; different so nothing should happen define i32 addrspace(4)* @test_constant_fold_inttoptr_as_pointer_smaller_different_as() { ; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_smaller_different_as( -; CHECK-NEXT: ret i32 addrspace(4)* inttoptr (i16 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i16) to i32 addrspace(4)*) +; CHECK-NEXT: ret i32 addrspace(4)* inttoptr (i16 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i16) to i32 addrspace(4)*) +; %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i16 %y = inttoptr i16 %x to i32 addrspace(4)* ret i32 addrspace(4)* %y @@ -45,7 +49,8 @@ define i32 addrspace(4)* @test_constant_fold_inttoptr_as_pointer_smaller_differe ; address spaces when folding this define i32 addrspace(2)* @test_constant_fold_inttoptr_as_pointer_smaller_different_size_as() { ; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_smaller_different_size_as( -; CHECK-NEXT: ret i32 addrspace(2)* inttoptr (i32 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i32) to i32 addrspace(2)*) +; CHECK-NEXT: ret i32 addrspace(2)* inttoptr (i32 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i32) to i32 addrspace(2)*) +; %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i32 %y = inttoptr i32 %x to i32 addrspace(2)* ret i32 addrspace(2)* %y @@ -54,7 +59,8 @@ define i32 addrspace(2)* @test_constant_fold_inttoptr_as_pointer_smaller_differe ; The intermediate integer size is too small, nothing should happen define i32 addrspace(3)* @test_constant_fold_inttoptr_as_pointer_larger() { ; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_larger( -; CHECK-NEXT: ret i32 addrspace(3)* inttoptr (i8 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i8) to i32 addrspace(3)*) +; CHECK-NEXT: ret i32 addrspace(3)* inttoptr (i8 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i8) to i32 addrspace(3)*) +; %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i8 %y = inttoptr i8 %x to i32 addrspace(3)* ret i32 addrspace(3)* %y @@ -62,7 +68,8 @@ define i32 addrspace(3)* @test_constant_fold_inttoptr_as_pointer_larger() { define i8 @const_fold_ptrtoint() { ; CHECK-LABEL: @const_fold_ptrtoint( -; CHECK-NEXT: ret i8 4 +; CHECK-NEXT: ret i8 4 +; ret i8 ptrtoint (i32 addrspace(2)* inttoptr (i4 4 to i32 addrspace(2)*) to i8) } @@ -70,7 +77,8 @@ define i8 @const_fold_ptrtoint() { ; the original define i8 @const_fold_ptrtoint_mask() { ; CHECK-LABEL: @const_fold_ptrtoint_mask( -; CHECK-NEXT: ret i8 1 +; CHECK-NEXT: ret i8 1 +; ret i8 ptrtoint (i32 addrspace(3)* inttoptr (i32 257 to i32 addrspace(3)*) to i8) } @@ -78,68 +86,78 @@ define i8 @const_fold_ptrtoint_mask() { ; 64-bits instead of 32 define i64 @const_fold_ptrtoint_mask_small_as0() { ; CHECK-LABEL: @const_fold_ptrtoint_mask_small_as0( -; CHECK: ret i64 -1 +; CHECK-NEXT: ret i64 -1 +; ret i64 ptrtoint (i32 addrspace(1)* inttoptr (i128 -1 to i32 addrspace(1)*) to i64) } define i32 addrspace(3)* @const_inttoptr() { ; CHECK-LABEL: @const_inttoptr( -; CHECK-NEXT: ret i32 addrspace(3)* inttoptr (i16 4 to i32 addrspace(3)*) +; CHECK-NEXT: ret i32 addrspace(3)* inttoptr (i16 4 to i32 addrspace(3)*) +; %p = inttoptr i16 4 to i32 addrspace(3)* ret i32 addrspace(3)* %p } define i16 @const_ptrtoint() { ; CHECK-LABEL: @const_ptrtoint( -; CHECK-NEXT: ret i16 ptrtoint (i32 addrspace(3)* @g to i16) +; CHECK-NEXT: ret i16 ptrtoint (i32 addrspace(3)* @g to i16) +; %i = ptrtoint i32 addrspace(3)* @g to i16 ret i16 %i } define i16 @const_inttoptr_ptrtoint() { ; CHECK-LABEL: @const_inttoptr_ptrtoint( -; CHECK-NEXT: ret i16 9 +; CHECK-NEXT: ret i16 9 +; ret i16 ptrtoint (i32 addrspace(3)* inttoptr (i16 9 to i32 addrspace(3)*) to i16) } define i1 @constant_fold_cmp_constantexpr_inttoptr() { ; CHECK-LABEL: @constant_fold_cmp_constantexpr_inttoptr( -; CHECK-NEXT: ret i1 true +; CHECK-NEXT: ret i1 true +; %x = icmp eq i32 addrspace(3)* inttoptr (i16 0 to i32 addrspace(3)*), null ret i1 %x } define i1 @constant_fold_inttoptr_null(i16 %i) { ; CHECK-LABEL: @constant_fold_inttoptr_null( -; CHECK-NEXT: ret i1 false +; CHECK-NEXT: ret i1 false +; %x = icmp eq i32 addrspace(3)* inttoptr (i16 99 to i32 addrspace(3)*), inttoptr (i16 0 to i32 addrspace(3)*) ret i1 %x } define i1 @constant_fold_ptrtoint_null() { ; CHECK-LABEL: @constant_fold_ptrtoint_null( -; CHECK-NEXT: ret i1 icmp eq (i32 addrspace(3)* @g, i32 addrspace(3)* null) +; CHECK-NEXT: ret i1 icmp eq (i32 addrspace(3)* @g, i32 addrspace(3)* null) +; %x = icmp eq i16 ptrtoint (i32 addrspace(3)* @g to i16), ptrtoint (i32 addrspace(3)* null to i16) ret i1 %x } define i1 @constant_fold_ptrtoint_null_2() { ; CHECK-LABEL: @constant_fold_ptrtoint_null_2( -; CHECK-NEXT: ret i1 icmp eq (i32 addrspace(3)* @g, i32 addrspace(3)* null) +; CHECK-NEXT: ret i1 icmp eq (i32 addrspace(3)* @g, i32 addrspace(3)* null) +; %x = icmp eq i16 ptrtoint (i32 addrspace(3)* null to i16), ptrtoint (i32 addrspace(3)* @g to i16) ret i1 %x } define i1 @constant_fold_ptrtoint() { ; CHECK-LABEL: @constant_fold_ptrtoint( -; CHECK-NEXT: ret i1 true +; CHECK-NEXT: ret i1 true +; %x = icmp eq i16 ptrtoint (i32 addrspace(3)* @g to i16), ptrtoint (i32 addrspace(3)* @g to i16) ret i1 %x } define i1 @constant_fold_inttoptr() { ; CHECK-LABEL: @constant_fold_inttoptr( -; CHECK-NEXT: ret i1 false +; CHECK-NEXT: ret i1 false +; %x = icmp eq i32 addrspace(3)* inttoptr (i16 99 to i32 addrspace(3)*), inttoptr (i16 27 to i32 addrspace(3)*) ret i1 %x } @@ -149,21 +167,27 @@ define i1 @constant_fold_inttoptr() { define float @constant_fold_bitcast_ftoi_load() { ; CHECK-LABEL: @constant_fold_bitcast_ftoi_load( -; CHECK: load float, float addrspace(3)* bitcast (i32 addrspace(3)* @g to float addrspace(3)*), align 4 +; CHECK-NEXT: [[A:%.*]] = load float, float addrspace(3)* bitcast (i32 addrspace(3)* @g to float addrspace(3)*), align 4 +; CHECK-NEXT: ret float [[A]] +; %a = load float, float addrspace(3)* bitcast (i32 addrspace(3)* @g to float addrspace(3)*), align 4 ret float %a } define i32 @constant_fold_bitcast_itof_load() { ; CHECK-LABEL: @constant_fold_bitcast_itof_load( -; CHECK: load i32, i32 addrspace(3)* bitcast (float addrspace(3)* @g_float_as3 to i32 addrspace(3)*), align 4 +; CHECK-NEXT: [[A:%.*]] = load i32, i32 addrspace(3)* bitcast (float addrspace(3)* @g_float_as3 to i32 addrspace(3)*), align 4 +; CHECK-NEXT: ret i32 [[A]] +; %a = load i32, i32 addrspace(3)* bitcast (float addrspace(3)* @g_float_as3 to i32 addrspace(3)*), align 4 ret i32 %a } define <4 x float> @constant_fold_bitcast_vector_as() { ; CHECK-LABEL: @constant_fold_bitcast_vector_as( -; CHECK: load <4 x float>, <4 x float> addrspace(3)* @g_v4f_as3, align 16 +; CHECK-NEXT: [[A:%.*]] = load <4 x float>, <4 x float> addrspace(3)* @g_v4f_as3, align 16 +; CHECK-NEXT: ret <4 x float> [[A]] +; %a = load <4 x float>, <4 x float> addrspace(3)* bitcast (<4 x i32> addrspace(3)* bitcast (<4 x float> addrspace(3)* @g_v4f_as3 to <4 x i32> addrspace(3)*) to <4 x float> addrspace(3)*), align 4 ret <4 x float> %a } @@ -172,10 +196,12 @@ define <4 x float> @constant_fold_bitcast_vector_as() { define i32 @test_cast_gep_small_indices_as() { ; CHECK-LABEL: @test_cast_gep_small_indices_as( -; CHECK: load i32, i32 addrspace(3)* getelementptr inbounds ([10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i16 0, i16 0), align 16 - %p = getelementptr [10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i7 0, i7 0 - %x = load i32, i32 addrspace(3)* %p, align 4 - ret i32 %x +; CHECK-NEXT: [[X:%.*]] = load i32, i32 addrspace(3)* getelementptr inbounds ([10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i16 0, i16 0), align 16 +; CHECK-NEXT: ret i32 [[X]] +; + %p = getelementptr [10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i7 0, i7 0 + %x = load i32, i32 addrspace(3)* %p, align 4 + ret i32 %x } %struct.foo = type { float, float, [4 x i32], i32 addrspace(3)* } @@ -189,15 +215,19 @@ define i32 @test_cast_gep_small_indices_as() { define i32 @test_cast_gep_large_indices_as() { ; CHECK-LABEL: @test_cast_gep_large_indices_as( -; CHECK: load i32, i32 addrspace(3)* getelementptr inbounds ([10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i16 0, i16 0), align 16 - %p = getelementptr [10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i64 0, i64 0 - %x = load i32, i32 addrspace(3)* %p, align 4 - ret i32 %x +; CHECK-NEXT: [[X:%.*]] = load i32, i32 addrspace(3)* getelementptr inbounds ([10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i16 0, i16 0), align 16 +; CHECK-NEXT: ret i32 [[X]] +; + %p = getelementptr [10 x i32], [10 x i32] addrspace(3)* @i32_array_as3, i64 0, i64 0 + %x = load i32, i32 addrspace(3)* %p, align 4 + ret i32 %x } define i32 @test_constant_cast_gep_struct_indices_as() { ; CHECK-LABEL: @test_constant_cast_gep_struct_indices_as( -; CHECK: load i32, i32 addrspace(3)* getelementptr inbounds (%struct.foo, %struct.foo addrspace(3)* @constant_fold_global_ptr, i16 0, i32 2, i16 2), align 8 +; CHECK-NEXT: [[Y:%.*]] = load i32, i32 addrspace(3)* getelementptr inbounds (%struct.foo, [[STRUCT_FOO:%.*]] addrspace(3)* @constant_fold_global_ptr, i16 0, i32 2, i16 2), align 8 +; CHECK-NEXT: ret i32 [[Y]] +; %x = getelementptr %struct.foo, %struct.foo addrspace(3)* @constant_fold_global_ptr, i18 0, i32 2, i12 2 %y = load i32, i32 addrspace(3)* %x, align 4 ret i32 %y @@ -207,7 +237,8 @@ define i32 @test_constant_cast_gep_struct_indices_as() { define i32 @test_read_data_from_global_as3() { ; CHECK-LABEL: @test_read_data_from_global_as3( -; CHECK-NEXT: ret i32 2 +; CHECK-NEXT: ret i32 2 +; %x = getelementptr [5 x i32], [5 x i32] addrspace(3)* @constant_data_as3, i32 0, i32 1 %y = load i32, i32 addrspace(3)* %x, align 4 ret i32 %y @@ -223,7 +254,8 @@ define i32 @test_read_data_from_global_as3() { define i32 @constant_through_array_as_ptrs() { ; CHECK-LABEL: @constant_through_array_as_ptrs( -; CHECK-NEXT: ret i32 34 +; CHECK-NEXT: ret i32 34 +; %p = load i32 addrspace(1)* addrspace(2)*, i32 addrspace(1)* addrspace(2)* addrspace(0)* @indirect, align 4 %a = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(2)* %p, align 4 %b = load i32, i32 addrspace(1)* %a, align 4 @@ -233,8 +265,11 @@ define i32 @constant_through_array_as_ptrs() { @shared_mem = external addrspace(3) global [0 x i8] define float @canonicalize_addrspacecast(i32 %i) { -; CHECK-LABEL: @canonicalize_addrspacecast -; CHECK-NEXT: getelementptr inbounds float, float* addrspacecast (float addrspace(3)* bitcast ([0 x i8] addrspace(3)* @shared_mem to float addrspace(3)*) to float*), i32 %i +; CHECK-LABEL: @canonicalize_addrspacecast( +; CHECK-NEXT: [[P:%.*]] = getelementptr inbounds float, float* addrspacecast (float addrspace(3)* bitcast ([0 x i8] addrspace(3)* @shared_mem to float addrspace(3)*) to float*), i32 [[I:%.*]] +; CHECK-NEXT: [[V:%.*]] = load float, float* [[P]], align 4 +; CHECK-NEXT: ret float [[V]] +; %p = getelementptr inbounds float, float* addrspacecast ([0 x i8] addrspace(3)* @shared_mem to float*), i32 %i %v = load float, float* %p ret float %v diff --git a/llvm/test/Transforms/InstCombine/constant-fold-gep.ll b/llvm/test/Transforms/InstCombine/constant-fold-gep.ll index 7709052..277a900a 100644 --- a/llvm/test/Transforms/InstCombine/constant-fold-gep.ll +++ b/llvm/test/Transforms/InstCombine/constant-fold-gep.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instcombine -S | FileCheck %s target datalayout = "E-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" @@ -9,57 +10,63 @@ target datalayout = "E-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32- @Y = internal global [3 x %struct.X] zeroinitializer define void @frob() { -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 16 +; CHECK-LABEL: @frob( +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 16 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 8 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 0), align 4 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 1), align 4 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 2), align 4 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 0), align 8 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 1), align 4 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 2), align 8 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 0), align 4 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 1), align 4 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 2), align 4 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 0), align 16 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 1), align 4 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 2), align 8 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 0), align 8 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 1), align 8 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 2), align 8 +; CHECK-NEXT: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 0), align 8 +; CHECK-NEXT: store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 2, i64 0, i32 0, i64 0), align 16 +; CHECK-NEXT: store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 1), align 8 +; CHECK-NEXT: ret void +; store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 8 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 0), align 4 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 3), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 1), align 4 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 4), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 2), align 4 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 5), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 0), align 8 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 6), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 1), align 4 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 7), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 2), align 8 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 8), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 0), align 4 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 9), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 1), align 4 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 10), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 2), align 4 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 11), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 0), align 16 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 12), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 1), align 4 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 13), align 4 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 2), align 8 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 14), align 8 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 0), align 8 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 15), align 8 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 1), align 8 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 16), align 8 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 2), align 8 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 17), align 8 -; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X], [3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 0), align 8 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 18), align 8 -; CHECK: store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 2, i64 0, i32 0, i64 0), align 16 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 36), align 8 -; CHECK: store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 1), align 8 store i32 1, i32* getelementptr ([3 x %struct.X], [3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 19), align 8 ret void } ; PR8883 - Constant fold exotic gep subtract -; CHECK-LABEL: @test2( @X = global [1000 x i8] zeroinitializer, align 16 define i64 @test2() { +; CHECK-LABEL: @test2( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret i64 1000 +; entry: %A = bitcast i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @X, i64 1, i64 0) to i8* %B = bitcast i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @X, i64 0, i64 0) to i8* @@ -70,14 +77,15 @@ entry: %E = ptrtoint i8* %D to i64 ret i64 %E - ; CHECK: ret i64 1000 } @X_as1 = addrspace(1) global [1000 x i8] zeroinitializer, align 16 define i16 @test2_as1() { ; CHECK-LABEL: @test2_as1( - ; CHECK: ret i16 1000 +; CHECK-NEXT: entry: +; CHECK-NEXT: ret i16 1000 +; entry: %A = bitcast i8 addrspace(1)* getelementptr inbounds ([1000 x i8], [1000 x i8] addrspace(1)* @X_as1, i64 1, i64 0) to i8 addrspace(1)* diff --git a/llvm/test/Transforms/InstCombine/gep-custom-dl.ll b/llvm/test/Transforms/InstCombine/gep-custom-dl.ll index fdadc80..cac9030 100644 --- a/llvm/test/Transforms/InstCombine/gep-custom-dl.ll +++ b/llvm/test/Transforms/InstCombine/gep-custom-dl.ll @@ -101,7 +101,7 @@ define i1 @test5({ i32, i32 }* %x, { i32, i32 }* %y) { define <2 x i1> @test6(<2 x i32> %X, <2 x %S*> %P) nounwind { ; CHECK-LABEL: @test6( -; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> %X, +; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> [[X:%.*]], ; CHECK-NEXT: ret <2 x i1> [[C]] ; %A = getelementptr inbounds %S, <2 x %S*> %P, <2 x i32> zeroinitializer, <2 x i32> , <2 x i32> %X @@ -113,7 +113,7 @@ define <2 x i1> @test6(<2 x i32> %X, <2 x %S*> %P) nounwind { ; Same as above, but indices scalarized. define <2 x i1> @test6b(<2 x i32> %X, <2 x %S*> %P) nounwind { ; CHECK-LABEL: @test6b( -; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> %X, +; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> [[X:%.*]], ; CHECK-NEXT: ret <2 x i1> [[C]] ; %A = getelementptr inbounds %S, <2 x %S*> %P, i32 0, i32 1, <2 x i32> %X @@ -169,7 +169,9 @@ define i32 @test10() { define i16 @constant_fold_custom_dl() { ; CHECK-LABEL: @constant_fold_custom_dl( - ; CHECK: ret i16 ptrtoint +; CHECK-NEXT: entry: +; CHECK-NEXT: ret i16 ptrtoint (i8 addrspace(1)* getelementptr (i8, i8 addrspace(1)* getelementptr inbounds ([1000 x i8], [1000 x i8] addrspace(1)* @X_as1, i32 1, i32 0), i32 sext (i16 sub (i16 0, i16 ptrtoint ([1000 x i8] addrspace(1)* @X_as1 to i16)) to i32)) to i16) +; entry: %A = bitcast i8 addrspace(1)* getelementptr inbounds ([1000 x i8], [1000 x i8] addrspace(1)* @X_as1, i64 1, i64 0) to i8 addrspace(1)* diff --git a/llvm/test/Transforms/InstCombine/getelementptr.ll b/llvm/test/Transforms/InstCombine/getelementptr.ll index 17362b0..85ef011 100644 --- a/llvm/test/Transforms/InstCombine/getelementptr.ll +++ b/llvm/test/Transforms/InstCombine/getelementptr.ll @@ -538,7 +538,7 @@ define i32 @test27(%struct.compat_siginfo* %to, %struct.siginfo_t* %from) { ; CHECK-NEXT: [[TMP349:%.*]] = getelementptr [[STRUCT_SIGINFO_T:%.*]], %struct.siginfo_t* [[TMP344]], i64 0, i32 3, i32 0, i32 3, i32 0 ; CHECK-NEXT: [[TMP349350:%.*]] = bitcast i8** [[TMP349]] to i32* ; CHECK-NEXT: [[TMP351:%.*]] = load i32, i32* [[TMP349350]], align 8 -; CHECK-NEXT: [[TMP360:%.*]] = call i32 asm sideeffect "...", "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"(i32 [[TMP351]], %struct.__large_struct* null, i32 -14, i32 0) #0 +; CHECK-NEXT: [[TMP360:%.*]] = call i32 asm sideeffect "...", "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"(i32 [[TMP351]], %struct.__large_struct* null, i32 -14, i32 0) [[ATTR0:#.*]] ; CHECK-NEXT: unreachable ; entry: @@ -566,14 +566,14 @@ define i32 @test28() nounwind { ; CHECK-LABEL: @test28( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[ORIENTATIONS:%.*]] = alloca [1 x [1 x %struct.x]], align 8 -; CHECK-NEXT: [[TMP3:%.*]] = call i32 @puts(i8* nonnull dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)) #0 +; CHECK-NEXT: [[TMP3:%.*]] = call i32 @puts(i8* nonnull dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)) [[ATTR0]] ; CHECK-NEXT: br label [[BB10:%.*]] ; CHECK: bb10: ; CHECK-NEXT: [[INDVAR:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDVAR_NEXT:%.*]], [[BB10]] ] ; CHECK-NEXT: [[TMP12_REC:%.*]] = xor i32 [[INDVAR]], -1 ; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[TMP12_REC]] to i64 ; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds [1 x [1 x %struct.x]], [1 x [1 x %struct.x]]* [[ORIENTATIONS]], i64 1, i64 0, i64 [[TMP0]] -; CHECK-NEXT: [[TMP16:%.*]] = call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str1, i64 0, i64 0), %struct.x* nonnull [[TMP12]]) #0 +; CHECK-NEXT: [[TMP16:%.*]] = call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str1, i64 0, i64 0), %struct.x* nonnull [[TMP12]]) [[ATTR0]] ; CHECK-NEXT: [[TMP84:%.*]] = icmp eq i32 [[INDVAR]], 0 ; CHECK-NEXT: [[INDVAR_NEXT]] = add i32 [[INDVAR]], 1 ; CHECK-NEXT: br i1 [[TMP84]], label [[BB17:%.*]], label [[BB10]] @@ -648,7 +648,7 @@ define i32 @test30(i32 %m, i32 %n) nounwind { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[N:%.*]] to i64 ; CHECK-NEXT: [[TMP1:%.*]] = alloca i32, i64 [[TMP0]], align 4 -; CHECK-NEXT: call void @test30f(i32* nonnull [[TMP1]]) #0 +; CHECK-NEXT: call void @test30f(i32* nonnull [[TMP1]]) [[ATTR0]] ; CHECK-NEXT: [[TMP2:%.*]] = sext i32 [[M:%.*]] to i64 ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr i32, i32* [[TMP1]], i64 [[TMP2]] ; CHECK-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP3]], align 4 @@ -787,7 +787,7 @@ entry: define i32 @test35() nounwind { ; CHECK-LABEL: @test35( -; CHECK-NEXT: [[TMP1:%.*]] = call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @"\01LC8", i64 0, i64 0), i8* getelementptr inbounds (%t0, %t0* @s, i64 0, i32 1, i64 0)) #0 +; CHECK-NEXT: [[TMP1:%.*]] = call i32 (i8*, ...) @printf(i8* nonnull dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @"\01LC8", i64 0, i64 0), i8* getelementptr inbounds (%t0, %t0* @s, i64 0, i32 1, i64 0)) [[ATTR0]] ; CHECK-NEXT: ret i32 0 ; call i32 (i8*, ...) @printf(i8* getelementptr ([17 x i8], [17 x i8]* @"\01LC8", i32 0, i32 0), @@ -833,9 +833,9 @@ define void @pr10322_f1(%pr10322_t* %foo) { ; CHECK-LABEL: @pr10322_f1( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds [[PR10322_T:%.*]], %pr10322_t* [[FOO:%.*]], i64 2 -; CHECK-NEXT: call void @pr10322_f2(%pr10322_t* nonnull [[ARRAYIDX8]]) #0 +; CHECK-NEXT: call void @pr10322_f2(%pr10322_t* nonnull [[ARRAYIDX8]]) [[ATTR0]] ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[PR10322_T]], %pr10322_t* [[ARRAYIDX8]], i64 0, i32 0 -; CHECK-NEXT: call void @pr10322_f3(i8** nonnull [[TMP2]]) #0 +; CHECK-NEXT: call void @pr10322_f3(i8** nonnull [[TMP2]]) [[ATTR0]] ; CHECK-NEXT: ret void ; entry: diff --git a/llvm/test/Transforms/InstCombine/loadstore-alignment.ll b/llvm/test/Transforms/InstCombine/loadstore-alignment.ll index e821fb2..299b5e3 100644 --- a/llvm/test/Transforms/InstCombine/loadstore-alignment.ll +++ b/llvm/test/Transforms/InstCombine/loadstore-alignment.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -instcombine -S < %s | FileCheck %s target datalayout = "E-p:64:64:64-p1:64:64:64-p2:32:32:32-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" @@ -6,81 +7,114 @@ target datalayout = "E-p:64:64:64-p1:64:64:64-p2:32:32:32-a0:0:8-f32:32:32-f64:6 @x.as2 = external addrspace(2) global <2 x i64>, align 16 -; CHECK-LABEL: @static_hem( -; CHECK: , align 16 define <2 x i64> @static_hem() { +; CHECK-LABEL: @static_hem( +; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, <2 x i64>* getelementptr (<2 x i64>, <2 x i64>* @x, i64 7), align 16 +; CHECK-NEXT: ret <2 x i64> [[TMP1]] +; %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 7 %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1 ret <2 x i64> %tmp1 } -; CHECK-LABEL: @hem( -; CHECK: , align 16 define <2 x i64> @hem(i32 %i) { +; CHECK-LABEL: @hem( +; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[I:%.*]] to i64 +; CHECK-NEXT: [[T:%.*]] = getelementptr <2 x i64>, <2 x i64>* @x, i64 [[TMP1]] +; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, <2 x i64>* [[T]], align 16 +; CHECK-NEXT: ret <2 x i64> [[TMP1]] +; %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 %i %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1 ret <2 x i64> %tmp1 } -; CHECK-LABEL: @hem_2d( -; CHECK: , align 16 define <2 x i64> @hem_2d(i32 %i, i32 %j) { +; CHECK-LABEL: @hem_2d( +; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[I:%.*]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = sext i32 [[J:%.*]] to i64 +; CHECK-NEXT: [[T:%.*]] = getelementptr [13 x <2 x i64>], [13 x <2 x i64>]* @xx, i64 [[TMP1]], i64 [[TMP2]] +; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, <2 x i64>* [[T]], align 16 +; CHECK-NEXT: ret <2 x i64> [[TMP1]] +; %t = getelementptr [13 x <2 x i64>], [13 x <2 x i64>]* @xx, i32 %i, i32 %j %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1 ret <2 x i64> %tmp1 } -; CHECK-LABEL: @foo( -; CHECK: , align 16 define <2 x i64> @foo() { +; CHECK-LABEL: @foo( +; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, <2 x i64>* @x, align 16 +; CHECK-NEXT: ret <2 x i64> [[TMP1]] +; %tmp1 = load <2 x i64>, <2 x i64>* @x, align 1 ret <2 x i64> %tmp1 } -; CHECK-LABEL: @bar( -; CHECK: , align 16 -; CHECK: , align 16 define <2 x i64> @bar() { +; CHECK-LABEL: @bar( +; CHECK-NEXT: [[T:%.*]] = alloca <2 x i64>, align 16 +; CHECK-NEXT: call void @kip(<2 x i64>* nonnull [[T]]) +; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, <2 x i64>* [[T]], align 16 +; CHECK-NEXT: ret <2 x i64> [[TMP1]] +; %t = alloca <2 x i64> call void @kip(<2 x i64>* %t) %tmp1 = load <2 x i64>, <2 x i64>* %t, align 1 ret <2 x i64> %tmp1 } -; CHECK-LABEL: @static_hem_store( -; CHECK: , align 16 define void @static_hem_store(<2 x i64> %y) { +; CHECK-LABEL: @static_hem_store( +; CHECK-NEXT: store <2 x i64> [[Y:%.*]], <2 x i64>* getelementptr (<2 x i64>, <2 x i64>* @x, i64 7), align 16 +; CHECK-NEXT: ret void +; %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 7 store <2 x i64> %y, <2 x i64>* %t, align 1 ret void } -; CHECK-LABEL: @hem_store( -; CHECK: , align 16 define void @hem_store(i32 %i, <2 x i64> %y) { +; CHECK-LABEL: @hem_store( +; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[I:%.*]] to i64 +; CHECK-NEXT: [[T:%.*]] = getelementptr <2 x i64>, <2 x i64>* @x, i64 [[TMP1]] +; CHECK-NEXT: store <2 x i64> [[Y:%.*]], <2 x i64>* [[T]], align 16 +; CHECK-NEXT: ret void +; %t = getelementptr <2 x i64>, <2 x i64>* @x, i32 %i store <2 x i64> %y, <2 x i64>* %t, align 1 ret void } -; CHECK-LABEL: @hem_2d_store( -; CHECK: , align 16 define void @hem_2d_store(i32 %i, i32 %j, <2 x i64> %y) { +; CHECK-LABEL: @hem_2d_store( +; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[I:%.*]] to i64 +; CHECK-NEXT: [[TMP2:%.*]] = sext i32 [[J:%.*]] to i64 +; CHECK-NEXT: [[T:%.*]] = getelementptr [13 x <2 x i64>], [13 x <2 x i64>]* @xx, i64 [[TMP1]], i64 [[TMP2]] +; CHECK-NEXT: store <2 x i64> [[Y:%.*]], <2 x i64>* [[T]], align 16 +; CHECK-NEXT: ret void +; %t = getelementptr [13 x <2 x i64>], [13 x <2 x i64>]* @xx, i32 %i, i32 %j store <2 x i64> %y, <2 x i64>* %t, align 1 ret void } -; CHECK-LABEL: @foo_store( -; CHECK: , align 16 define void @foo_store(<2 x i64> %y) { +; CHECK-LABEL: @foo_store( +; CHECK-NEXT: store <2 x i64> [[Y:%.*]], <2 x i64>* @x, align 16 +; CHECK-NEXT: ret void +; store <2 x i64> %y, <2 x i64>* @x, align 1 ret void } -; CHECK-LABEL: @bar_store( -; CHECK: , align 16 define void @bar_store(<2 x i64> %y) { +; CHECK-LABEL: @bar_store( +; CHECK-NEXT: [[T:%.*]] = alloca <2 x i64>, align 16 +; CHECK-NEXT: call void @kip(<2 x i64>* nonnull [[T]]) +; CHECK-NEXT: store <2 x i64> [[Y:%.*]], <2 x i64>* [[T]], align 16 +; CHECK-NEXT: ret void +; %t = alloca <2 x i64> call void @kip(<2 x i64>* %t) store <2 x i64> %y, <2 x i64>* %t, align 1 diff --git a/llvm/test/Transforms/InstCombine/memcpy-from-global.ll b/llvm/test/Transforms/InstCombine/memcpy-from-global.ll index 60a06d2..738cb9b 100644 --- a/llvm/test/Transforms/InstCombine/memcpy-from-global.ll +++ b/llvm/test/Transforms/InstCombine/memcpy-from-global.ll @@ -153,7 +153,7 @@ declare void @bar_as1(i8 addrspace(1)*) ;; Should be able to eliminate the alloca. define void @test3() { ; CHECK-LABEL: @test3( -; CHECK-NEXT: call void @bar(i8* getelementptr inbounds (%T, %T* @G, i64 0, i32 0)) #2 +; CHECK-NEXT: call void @bar(i8* getelementptr inbounds (%T, %T* @G, i64 0, i32 0)) [[ATTR2:#.*]] ; CHECK-NEXT: ret void ; %A = alloca %T @@ -165,7 +165,7 @@ define void @test3() { define void @test3_addrspacecast() { ; CHECK-LABEL: @test3_addrspacecast( -; CHECK-NEXT: call void @bar(i8* getelementptr inbounds (%T, %T* @G, i64 0, i32 0)) #2 +; CHECK-NEXT: call void @bar(i8* getelementptr inbounds (%T, %T* @G, i64 0, i32 0)) [[ATTR2]] ; CHECK-NEXT: ret void ; %A = alloca %T @@ -208,7 +208,7 @@ declare void @baz(i8* byval) define void @test6() { ; CHECK-LABEL: @test6( -; CHECK-NEXT: call void @bar(i8* bitcast ([2 x %U]* @H to i8*)) #2 +; CHECK-NEXT: call void @bar(i8* bitcast ([2 x %U]* @H to i8*)) [[ATTR2]] ; CHECK-NEXT: ret void ; %A = alloca %U, align 16 @@ -220,7 +220,7 @@ define void @test6() { define void @test7() { ; CHECK-LABEL: @test7( -; CHECK-NEXT: call void @bar(i8* bitcast ([2 x %U]* @H to i8*)) #2 +; CHECK-NEXT: call void @bar(i8* bitcast ([2 x %U]* @H to i8*)) [[ATTR2]] ; CHECK-NEXT: ret void ; %A = alloca %U, align 16 @@ -235,7 +235,7 @@ define void @test8() { ; CHECK-NEXT: [[AL:%.*]] = alloca [[U:%.*]], align 16 ; CHECK-NEXT: [[A:%.*]] = bitcast %U* [[AL]] to i8* ; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 16 dereferenceable(20) [[A]], i8* nonnull align 4 dereferenceable(20) bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64 1) to i8*), i64 20, i1 false) -; CHECK-NEXT: call void @bar(i8* nonnull [[A]]) #2 +; CHECK-NEXT: call void @bar(i8* nonnull [[A]]) [[ATTR2]] ; CHECK-NEXT: ret void ; %al = alloca %U, align 16 @@ -251,7 +251,7 @@ define void @test8_addrspacecast() { ; CHECK-NEXT: [[AL:%.*]] = alloca [[U:%.*]], align 16 ; CHECK-NEXT: [[A:%.*]] = bitcast %U* [[AL]] to i8* ; CHECK-NEXT: call void @llvm.memcpy.p0i8.p1i8.i64(i8* nonnull align 16 dereferenceable(20) [[A]], i8 addrspace(1)* align 4 dereferenceable(20) addrspacecast (i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64 1) to i8*) to i8 addrspace(1)*), i64 20, i1 false) -; CHECK-NEXT: call void @bar(i8* nonnull [[A]]) #2 +; CHECK-NEXT: call void @bar(i8* nonnull [[A]]) [[ATTR2]] ; CHECK-NEXT: ret void ; %Al = alloca %U, align 16 @@ -263,7 +263,7 @@ define void @test8_addrspacecast() { define void @test9() { ; CHECK-LABEL: @test9( -; CHECK-NEXT: call void @bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64 1) to i8*)) #2 +; CHECK-NEXT: call void @bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64 1) to i8*)) [[ATTR2]] ; CHECK-NEXT: ret void ; %A = alloca %U, align 4 @@ -275,7 +275,7 @@ define void @test9() { define void @test9_addrspacecast() { ; CHECK-LABEL: @test9_addrspacecast( -; CHECK-NEXT: call void @bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64 1) to i8*)) #2 +; CHECK-NEXT: call void @bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64 1) to i8*)) [[ATTR2]] ; CHECK-NEXT: ret void ; %A = alloca %U, align 4 -- 2.7.4