diff options
Diffstat (limited to 'llvm/test/Transforms/Mem2Reg')
29 files changed, 0 insertions, 1235 deletions
diff --git a/llvm/test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll b/llvm/test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll deleted file mode 100644 index 49b560551d4..00000000000 --- a/llvm/test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll +++ /dev/null @@ -1,11 +0,0 @@ -; Uninitialized values are not handled correctly. -; -; RUN: opt < %s -mem2reg -disable-output -; - -define i32 @test() { - ; To be promoted - %X = alloca i32 ; <i32*> [#uses=1] - %Y = load i32, i32* %X ; <i32> [#uses=1] - ret i32 %Y -} diff --git a/llvm/test/Transforms/Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll b/llvm/test/Transforms/Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll deleted file mode 100644 index 89bd4928a47..00000000000 --- a/llvm/test/Transforms/Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll +++ /dev/null @@ -1,12 +0,0 @@ -; This input caused the mem2reg pass to die because it was trying to promote -; the %r alloca, even though it is invalid to do so in this case! -; -; RUN: opt < %s -mem2reg - -define void @test() { - %r = alloca i32 ; <i32*> [#uses=2] - store i32 4, i32* %r - store i32* %r, i32** null - ret void -} - diff --git a/llvm/test/Transforms/Mem2Reg/2003-04-10-DFNotFound.ll b/llvm/test/Transforms/Mem2Reg/2003-04-10-DFNotFound.ll deleted file mode 100644 index 3665483458c..00000000000 --- a/llvm/test/Transforms/Mem2Reg/2003-04-10-DFNotFound.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: opt < %s -mem2reg - -define void @_Z3barv() { - %result = alloca i32 ; <i32*> [#uses=1] - ret void - ; No predecessors! - store i32 0, i32* %result - ret void -} - diff --git a/llvm/test/Transforms/Mem2Reg/2003-04-18-DeadBlockProblem.ll b/llvm/test/Transforms/Mem2Reg/2003-04-18-DeadBlockProblem.ll deleted file mode 100644 index 36bd9e64991..00000000000 --- a/llvm/test/Transforms/Mem2Reg/2003-04-18-DeadBlockProblem.ll +++ /dev/null @@ -1,16 +0,0 @@ -; This testcases makes sure that mem2reg can handle unreachable blocks. -; RUN: opt < %s -mem2reg - -define i32 @test() { - %X = alloca i32 ; <i32*> [#uses=2] - store i32 6, i32* %X - br label %Loop -Loop: ; preds = %EndOfLoop, %0 - store i32 5, i32* %X - br label %EndOfLoop -Unreachable: ; No predecessors! - br label %EndOfLoop -EndOfLoop: ; preds = %Unreachable, %Loop - br label %Loop -} - diff --git a/llvm/test/Transforms/Mem2Reg/2003-04-24-MultipleIdenticalSuccessors.ll b/llvm/test/Transforms/Mem2Reg/2003-04-24-MultipleIdenticalSuccessors.ll deleted file mode 100644 index a013ff401f6..00000000000 --- a/llvm/test/Transforms/Mem2Reg/2003-04-24-MultipleIdenticalSuccessors.ll +++ /dev/null @@ -1,16 +0,0 @@ -; Mem2reg used to only add one incoming value to a PHI node, even if it had -; multiple incoming edges from a block. -; -; RUN: opt < %s -mem2reg -disable-output - -define i32 @test(i1 %c1, i1 %c2) { - %X = alloca i32 ; <i32*> [#uses=2] - br i1 %c1, label %Exit, label %B2 -B2: ; preds = %0 - store i32 2, i32* %X - br i1 %c2, label %Exit, label %Exit -Exit: ; preds = %B2, %B2, %0 - %Y = load i32, i32* %X ; <i32> [#uses=1] - ret i32 %Y -} - diff --git a/llvm/test/Transforms/Mem2Reg/2003-06-26-IterativePromote.ll b/llvm/test/Transforms/Mem2Reg/2003-06-26-IterativePromote.ll deleted file mode 100644 index de7280e4d8e..00000000000 --- a/llvm/test/Transforms/Mem2Reg/2003-06-26-IterativePromote.ll +++ /dev/null @@ -1,16 +0,0 @@ -; Promoting some values allows promotion of other values. -; RUN: opt < %s -mem2reg -S | not grep alloca - -define i32 @test2() { - %result = alloca i32 ; <i32*> [#uses=2] - %a = alloca i32 ; <i32*> [#uses=2] - %p = alloca i32* ; <i32**> [#uses=2] - store i32 0, i32* %a - store i32* %a, i32** %p - %tmp.0 = load i32*, i32** %p ; <i32*> [#uses=1] - %tmp.1 = load i32, i32* %tmp.0 ; <i32> [#uses=1] - store i32 %tmp.1, i32* %result - %tmp.2 = load i32, i32* %result ; <i32> [#uses=1] - ret i32 %tmp.2 -} - diff --git a/llvm/test/Transforms/Mem2Reg/2003-10-05-DeadPHIInsertion.ll b/llvm/test/Transforms/Mem2Reg/2003-10-05-DeadPHIInsertion.ll deleted file mode 100644 index 8d55a1d0fa1..00000000000 --- a/llvm/test/Transforms/Mem2Reg/2003-10-05-DeadPHIInsertion.ll +++ /dev/null @@ -1,22 +0,0 @@ -; Mem2reg should not insert dead PHI nodes! The naive algorithm inserts a PHI -; node in L3, even though there is no load of %A in anything dominated by L3. - -; RUN: opt < %s -mem2reg -S | not grep phi - -define void @test(i32 %B, i1 %C) { - %A = alloca i32 ; <i32*> [#uses=4] - store i32 %B, i32* %A - br i1 %C, label %L1, label %L2 -L1: ; preds = %0 - store i32 %B, i32* %A - %D = load i32, i32* %A ; <i32> [#uses=1] - call void @test( i32 %D, i1 false ) - br label %L3 -L2: ; preds = %0 - %E = load i32, i32* %A ; <i32> [#uses=1] - call void @test( i32 %E, i1 true ) - br label %L3 -L3: ; preds = %L2, %L1 - ret void -} - diff --git a/llvm/test/Transforms/Mem2Reg/2005-06-30-ReadBeforeWrite.ll b/llvm/test/Transforms/Mem2Reg/2005-06-30-ReadBeforeWrite.ll deleted file mode 100644 index f0f1fdc7ee2..00000000000 --- a/llvm/test/Transforms/Mem2Reg/2005-06-30-ReadBeforeWrite.ll +++ /dev/null @@ -1,47 +0,0 @@ -; RUN: opt < %s -mem2reg -instcombine -S | grep store -; PR590 - - -define void @zero(i8* %p, i32 %n) { -entry: - %p_addr = alloca i8* ; <i8**> [#uses=2] - %n_addr = alloca i32 ; <i32*> [#uses=2] - %i = alloca i32 ; <i32*> [#uses=6] - %out = alloca i32 ; <i32*> [#uses=2] - %undef = alloca i32 ; <i32*> [#uses=2] - store i8* %p, i8** %p_addr - store i32 %n, i32* %n_addr - store i32 0, i32* %i - br label %loopentry -loopentry: ; preds = %endif, %entry - %tmp.0 = load i32, i32* %n_addr ; <i32> [#uses=1] - %tmp.1 = add i32 %tmp.0, 1 ; <i32> [#uses=1] - %tmp.2 = load i32, i32* %i ; <i32> [#uses=1] - %tmp.3 = icmp sgt i32 %tmp.1, %tmp.2 ; <i1> [#uses=2] - %tmp.4 = zext i1 %tmp.3 to i32 ; <i32> [#uses=0] - br i1 %tmp.3, label %no_exit, label %return -no_exit: ; preds = %loopentry - %tmp.5 = load i32, i32* %undef ; <i32> [#uses=1] - store i32 %tmp.5, i32* %out - store i32 0, i32* %undef - %tmp.6 = load i32, i32* %i ; <i32> [#uses=1] - %tmp.7 = icmp sgt i32 %tmp.6, 0 ; <i1> [#uses=2] - %tmp.8 = zext i1 %tmp.7 to i32 ; <i32> [#uses=0] - br i1 %tmp.7, label %then, label %endif -then: ; preds = %no_exit - %tmp.9 = load i8*, i8** %p_addr ; <i8*> [#uses=1] - %tmp.10 = load i32, i32* %i ; <i32> [#uses=1] - %tmp.11 = sub i32 %tmp.10, 1 ; <i32> [#uses=1] - %tmp.12 = getelementptr i8, i8* %tmp.9, i32 %tmp.11 ; <i8*> [#uses=1] - %tmp.13 = load i32, i32* %out ; <i32> [#uses=1] - %tmp.14 = trunc i32 %tmp.13 to i8 ; <i8> [#uses=1] - store i8 %tmp.14, i8* %tmp.12 - br label %endif -endif: ; preds = %then, %no_exit - %tmp.15 = load i32, i32* %i ; <i32> [#uses=1] - %inc = add i32 %tmp.15, 1 ; <i32> [#uses=1] - store i32 %inc, i32* %i - br label %loopentry -return: ; preds = %loopentry - ret void -} diff --git a/llvm/test/Transforms/Mem2Reg/2005-11-28-Crash.ll b/llvm/test/Transforms/Mem2Reg/2005-11-28-Crash.ll deleted file mode 100644 index 4b1d7f6651f..00000000000 --- a/llvm/test/Transforms/Mem2Reg/2005-11-28-Crash.ll +++ /dev/null @@ -1,62 +0,0 @@ -; RUN: opt < %s -mem2reg -disable-output -; PR670 - -define void @printk(i32, ...) { -entry: - %flags = alloca i32 ; <i32*> [#uses=2] - br i1 false, label %then.0, label %endif.0 -then.0: ; preds = %entry - br label %endif.0 -endif.0: ; preds = %then.0, %entry - store i32 0, i32* %flags - br label %loopentry -loopentry: ; preds = %endif.3, %endif.0 - br i1 false, label %no_exit, label %loopexit -no_exit: ; preds = %loopentry - br i1 false, label %then.1, label %endif.1 -then.1: ; preds = %no_exit - br i1 false, label %shortcirc_done.0, label %shortcirc_next.0 -shortcirc_next.0: ; preds = %then.1 - br label %shortcirc_done.0 -shortcirc_done.0: ; preds = %shortcirc_next.0, %then.1 - br i1 false, label %shortcirc_done.1, label %shortcirc_next.1 -shortcirc_next.1: ; preds = %shortcirc_done.0 - br label %shortcirc_done.1 -shortcirc_done.1: ; preds = %shortcirc_next.1, %shortcirc_done.0 - br i1 false, label %shortcirc_done.2, label %shortcirc_next.2 -shortcirc_next.2: ; preds = %shortcirc_done.1 - br label %shortcirc_done.2 -shortcirc_done.2: ; preds = %shortcirc_next.2, %shortcirc_done.1 - br i1 false, label %then.2, label %endif.2 -then.2: ; preds = %shortcirc_done.2 - br label %endif.2 -endif.2: ; preds = %then.2, %shortcirc_done.2 - br label %endif.1 -endif.1: ; preds = %endif.2, %no_exit - br i1 false, label %then.3, label %endif.3 -then.3: ; preds = %endif.1 - br label %endif.3 -endif.3: ; preds = %then.3, %endif.1 - br label %loopentry -loopexit: ; preds = %loopentry - br label %endif.4 -then.4: ; No predecessors! - %tmp.61 = load i32, i32* %flags ; <i32> [#uses=0] - br label %out -dead_block_after_goto: ; No predecessors! - br label %endif.4 -endif.4: ; preds = %dead_block_after_goto, %loopexit - br i1 false, label %then.5, label %else -then.5: ; preds = %endif.4 - br label %endif.5 -else: ; preds = %endif.4 - br label %endif.5 -endif.5: ; preds = %else, %then.5 - br label %out -out: ; preds = %endif.5, %then.4 - br label %return -after_ret: ; No predecessors! - br label %return -return: ; preds = %after_ret, %out - ret void -} diff --git a/llvm/test/Transforms/Mem2Reg/2007-08-27-VolatileLoadsStores.ll b/llvm/test/Transforms/Mem2Reg/2007-08-27-VolatileLoadsStores.ll deleted file mode 100644 index 891af9843ed..00000000000 --- a/llvm/test/Transforms/Mem2Reg/2007-08-27-VolatileLoadsStores.ll +++ /dev/null @@ -1,47 +0,0 @@ -; RUN: opt < %s -O3 -S | grep volatile | count 3 -; PR1520 -; Don't promote load volatiles/stores. This is really needed to handle setjmp/lonjmp properly. - -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:32:32" -target triple = "i686-pc-linux-gnu" - %struct.__jmp_buf_tag = type { [6 x i32], i32, %struct.__sigset_t } - %struct.__sigset_t = type { [32 x i32] } -@j = external global [1 x %struct.__jmp_buf_tag] ; <[1 x %struct.__jmp_buf_tag]*> [#uses=1] - -define i32 @f() { -entry: - %retval = alloca i32, align 4 ; <i32*> [#uses=2] - %v = alloca i32, align 4 ; <i32*> [#uses=3] - %tmp = alloca i32, align 4 ; <i32*> [#uses=3] - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - store volatile i32 0, i32* %v, align 4 - %tmp1 = call i32 @_setjmp( %struct.__jmp_buf_tag* getelementptr ([1 x %struct.__jmp_buf_tag], [1 x %struct.__jmp_buf_tag]* @j, i32 0, i32 0) ) ; <i32> [#uses=1] - %tmp2 = icmp ne i32 %tmp1, 0 ; <i1> [#uses=1] - %tmp23 = zext i1 %tmp2 to i8 ; <i8> [#uses=1] - %toBool = icmp ne i8 %tmp23, 0 ; <i1> [#uses=1] - br i1 %toBool, label %bb, label %bb5 - -bb: ; preds = %entry - %tmp4 = load volatile i32, i32* %v, align 4 ; <i32> [#uses=1] - store i32 %tmp4, i32* %tmp, align 4 - br label %bb6 - -bb5: ; preds = %entry - store volatile i32 1, i32* %v, align 4 - call void @g( ) - store i32 0, i32* %tmp, align 4 - br label %bb6 - -bb6: ; preds = %bb5, %bb - %tmp7 = load i32, i32* %tmp, align 4 ; <i32> [#uses=1] - store i32 %tmp7, i32* %retval, align 4 - br label %return - -return: ; preds = %bb6 - %retval8 = load i32, i32* %retval ; <i32> [#uses=1] - ret i32 %retval8 -} - -declare i32 @_setjmp(%struct.__jmp_buf_tag*) returns_twice - -declare void @g() diff --git a/llvm/test/Transforms/Mem2Reg/ConvertDebugInfo.ll b/llvm/test/Transforms/Mem2Reg/ConvertDebugInfo.ll deleted file mode 100644 index e83c8226a88..00000000000 --- a/llvm/test/Transforms/Mem2Reg/ConvertDebugInfo.ll +++ /dev/null @@ -1,52 +0,0 @@ -; RUN: opt < %s -mem2reg -S | FileCheck %s - -define double @testfunc(i32 %i, double %j) nounwind ssp !dbg !1 { -entry: - %i_addr = alloca i32 ; <i32*> [#uses=2] - %j_addr = alloca double ; <double*> [#uses=2] - %retval = alloca double ; <double*> [#uses=2] - %0 = alloca double ; <double*> [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - call void @llvm.dbg.declare(metadata i32* %i_addr, metadata !0, metadata !DIExpression()), !dbg !8 -; CHECK: call void @llvm.dbg.value(metadata i32 %i, metadata ![[IVAR:[0-9]*]], metadata {{.*}}) -; CHECK: call void @llvm.dbg.value(metadata double %j, metadata ![[JVAR:[0-9]*]], metadata {{.*}}) -; CHECK: ![[IVAR]] = !DILocalVariable(name: "i" -; CHECK: ![[JVAR]] = !DILocalVariable(name: "j" - store i32 %i, i32* %i_addr - call void @llvm.dbg.declare(metadata double* %j_addr, metadata !9, metadata !DIExpression()), !dbg !8 - store double %j, double* %j_addr - %1 = load i32, i32* %i_addr, align 4, !dbg !10 ; <i32> [#uses=1] - %2 = add nsw i32 %1, 1, !dbg !10 ; <i32> [#uses=1] - %3 = sitofp i32 %2 to double, !dbg !10 ; <double> [#uses=1] - %4 = load double, double* %j_addr, align 8, !dbg !10 ; <double> [#uses=1] - %5 = fadd double %3, %4, !dbg !10 ; <double> [#uses=1] - store double %5, double* %0, align 8, !dbg !10 - %6 = load double, double* %0, align 8, !dbg !10 ; <double> [#uses=1] - store double %6, double* %retval, align 8, !dbg !10 - br label %return, !dbg !10 - -return: ; preds = %entry - %retval1 = load double, double* %retval, !dbg !10 ; <double> [#uses=1] - ret double %retval1, !dbg !10 -} - -declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone - -!llvm.dbg.cu = !{!3} -!llvm.module.flags = !{!14} - -!0 = !DILocalVariable(name: "i", line: 2, arg: 1, scope: !1, file: !2, type: !7) -!1 = distinct !DISubprogram(name: "testfunc", linkageName: "testfunc", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !3, scopeLine: 2, file: !12, scope: !2, type: !4) -!2 = !DIFile(filename: "testfunc.c", directory: "/tmp") -!3 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: FullDebug, file: !12, enums: !13, retainedTypes: !13) -!4 = !DISubroutineType(types: !5) -!5 = !{!6, !7, !6} -!6 = !DIBasicType(tag: DW_TAG_base_type, name: "double", size: 64, align: 64, encoding: DW_ATE_float) -!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!8 = !DILocation(line: 2, scope: !1) -!9 = !DILocalVariable(name: "j", line: 2, arg: 2, scope: !1, file: !2, type: !6) -!10 = !DILocation(line: 3, scope: !11) -!11 = distinct !DILexicalBlock(line: 2, column: 0, file: !12, scope: !1) -!12 = !DIFile(filename: "testfunc.c", directory: "/tmp") -!13 = !{} -!14 = !{i32 1, !"Debug Info Version", i32 3} diff --git a/llvm/test/Transforms/Mem2Reg/ConvertDebugInfo2.ll b/llvm/test/Transforms/Mem2Reg/ConvertDebugInfo2.ll deleted file mode 100644 index e2dd0e15f81..00000000000 --- a/llvm/test/Transforms/Mem2Reg/ConvertDebugInfo2.ll +++ /dev/null @@ -1,67 +0,0 @@ -; RUN: opt -S -mem2reg <%s | FileCheck %s - -declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone - -declare void @foo(i32, i64, i8*) - -define void @baz(i32 %a) nounwind ssp !dbg !1 { -; CHECK-LABEL: entry: -; CHECK-NEXT: %"alloca point" = bitcast i32 0 to i32{{$}} -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %a,{{.*}}, !dbg -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %a,{{.*}}, !dbg -; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 55,{{.*}}, !dbg -; CHECK-NEXT: call void @llvm.dbg.value(metadata i8* bitcast (void (i32)* @baz to i8*),{{.*}}, !dbg -; CHECK-NEXT: call void @foo({{.*}}, !dbg -; CHECK-NEXT: br label %return, !dbg -entry: - %x_addr.i = alloca i32 ; <i32*> [#uses=2] - %y_addr.i = alloca i64 ; <i64*> [#uses=2] - %z_addr.i = alloca i8* ; <i8**> [#uses=2] - %a_addr = alloca i32 ; <i32*> [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - call void @llvm.dbg.declare(metadata i32* %a_addr, metadata !0, metadata !DIExpression()), !dbg !7 - store i32 %a, i32* %a_addr - %0 = load i32, i32* %a_addr, align 4, !dbg !8 ; <i32> [#uses=1] - call void @llvm.dbg.declare(metadata i32* %x_addr.i, metadata !9, metadata !DIExpression()) nounwind, !dbg !15 - store i32 %0, i32* %x_addr.i - call void @llvm.dbg.declare(metadata i64* %y_addr.i, metadata !16, metadata !DIExpression()) nounwind, !dbg !15 - store i64 55, i64* %y_addr.i - call void @llvm.dbg.declare(metadata i8** %z_addr.i, metadata !17, metadata !DIExpression()) nounwind, !dbg !15 - store i8* bitcast (void (i32)* @baz to i8*), i8** %z_addr.i - %1 = load i32, i32* %x_addr.i, align 4, !dbg !18 ; <i32> [#uses=1] - %2 = load i64, i64* %y_addr.i, align 8, !dbg !18 ; <i64> [#uses=1] - %3 = load i8*, i8** %z_addr.i, align 8, !dbg !18 ; <i8*> [#uses=1] - call void @foo(i32 %1, i64 %2, i8* %3) nounwind, !dbg !18 - br label %return, !dbg !19 - -; CHECK-LABEL: return: -; CHECK-NEXT: ret void, !dbg -return: ; preds = %entry - ret void, !dbg !19 -} - -!llvm.dbg.cu = !{!3} -!llvm.module.flags = !{!22} -!0 = !DILocalVariable(name: "a", line: 8, arg: 1, scope: !1, file: !2, type: !6) -!1 = distinct !DISubprogram(name: "baz", linkageName: "baz", line: 8, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !3, scopeLine: 8, file: !20, scope: !2, type: !4) -!2 = !DIFile(filename: "bar.c", directory: "/tmp/") -!3 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: FullDebug, file: !20, enums: !21, retainedTypes: !21) -!4 = !DISubroutineType(types: !5) -!5 = !{null, !6} -!6 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!7 = !DILocation(line: 8, scope: !1) -!8 = !DILocation(line: 9, scope: !1) -!9 = !DILocalVariable(name: "x", line: 4, arg: 1, scope: !10, file: !2, type: !6) -!10 = distinct !DISubprogram(name: "bar", linkageName: "bar", line: 4, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !3, scopeLine: 4, file: !20, scope: !2, type: !11) -!11 = !DISubroutineType(types: !12) -!12 = !{null, !6, !13, !14} -!13 = !DIBasicType(tag: DW_TAG_base_type, name: "long int", size: 64, align: 64, encoding: DW_ATE_signed) -!14 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !20, scope: !2, baseType: null) -!15 = !DILocation(line: 4, scope: !10, inlinedAt: !8) -!16 = !DILocalVariable(name: "y", line: 4, arg: 2, scope: !10, file: !2, type: !13) -!17 = !DILocalVariable(name: "z", line: 4, arg: 3, scope: !10, file: !2, type: !14) -!18 = !DILocation(line: 5, scope: !10, inlinedAt: !8) -!19 = !DILocation(line: 10, scope: !1) -!20 = !DIFile(filename: "bar.c", directory: "/tmp/") -!21 = !{} -!22 = !{i32 1, !"Debug Info Version", i32 3} diff --git a/llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll b/llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll deleted file mode 100644 index 202b206d749..00000000000 --- a/llvm/test/Transforms/Mem2Reg/PromoteMemToRegister.ll +++ /dev/null @@ -1,21 +0,0 @@ -; Simple sanity check testcase. Both alloca's should be eliminated. -; RUN: opt < %s -debugify -mem2reg -check-debugify -S 2>&1 | FileCheck %s - -; CHECK-NOT: alloca -; CHECK: CheckModuleDebugify: PASS - -define double @testfunc(i32 %i, double %j) { - %I = alloca i32 ; <i32*> [#uses=4] - %J = alloca double ; <double*> [#uses=2] - store i32 %i, i32* %I - store double %j, double* %J - %t1 = load i32, i32* %I ; <i32> [#uses=1] - %t2 = add i32 %t1, 1 ; <i32> [#uses=1] - store i32 %t2, i32* %I - %t3 = load i32, i32* %I ; <i32> [#uses=1] - %t4 = sitofp i32 %t3 to double ; <double> [#uses=1] - %t5 = load double, double* %J ; <double> [#uses=1] - %t6 = fmul double %t4, %t5 ; <double> [#uses=1] - ret double %t6 -} - diff --git a/llvm/test/Transforms/Mem2Reg/UndefValuesMerge.ll b/llvm/test/Transforms/Mem2Reg/UndefValuesMerge.ll deleted file mode 100644 index eeeb72f8e5a..00000000000 --- a/llvm/test/Transforms/Mem2Reg/UndefValuesMerge.ll +++ /dev/null @@ -1,13 +0,0 @@ -; RUN: opt < %s -mem2reg -S | not grep phi - -define i32 @testfunc(i1 %C, i32 %i, i8 %j) { - %I = alloca i32 ; <i32*> [#uses=2] - br i1 %C, label %T, label %Cont -T: ; preds = %0 - store i32 %i, i32* %I - br label %Cont -Cont: ; preds = %T, %0 - %Y = load i32, i32* %I ; <i32> [#uses=1] - ret i32 %Y -} - diff --git a/llvm/test/Transforms/Mem2Reg/atomic.ll b/llvm/test/Transforms/Mem2Reg/atomic.ll deleted file mode 100644 index f20043d9716..00000000000 --- a/llvm/test/Transforms/Mem2Reg/atomic.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: opt -mem2reg < %s -S | FileCheck %s - -; mem2reg is allowed with arbitrary atomic operations (although we only support -; it for atomic load and store at the moment). -define i32 @test1(i32 %x) { -; CHECK-LABEL: @test1( -; CHECK: ret i32 %x - %a = alloca i32 - store atomic i32 %x, i32* %a seq_cst, align 4 - %r = load atomic i32, i32* %a seq_cst, align 4 - ret i32 %r -} diff --git a/llvm/test/Transforms/Mem2Reg/crash.ll b/llvm/test/Transforms/Mem2Reg/crash.ll deleted file mode 100644 index d7ed1dd13e8..00000000000 --- a/llvm/test/Transforms/Mem2Reg/crash.ll +++ /dev/null @@ -1,44 +0,0 @@ -; RUN: opt < %s -mem2reg -S -; PR5023 - -declare i32 @test1f() - -define i32 @test1() personality i32 (...)* @__gxx_personality_v0 { -entry: - %whichFlag = alloca i32 - %A = invoke i32 @test1f() - to label %invcont2 unwind label %lpad86 - -invcont2: - store i32 %A, i32* %whichFlag - br label %bb15 - -bb15: - %B = load i32, i32* %whichFlag - ret i32 %B - -lpad86: - %exn = landingpad {i8*, i32} - cleanup - br label %bb15 - -} - -declare i32 @__gxx_personality_v0(...) - - -define i32 @test2() { -entry: - %whichFlag = alloca i32 - br label %bb15 - -bb15: - %B = load i32, i32* %whichFlag - ret i32 %B - -invcont2: - %C = load i32, i32* %whichFlag - store i32 %C, i32* %whichFlag - br label %bb15 -} - diff --git a/llvm/test/Transforms/Mem2Reg/dbg-addr-inline-dse.ll b/llvm/test/Transforms/Mem2Reg/dbg-addr-inline-dse.ll deleted file mode 100644 index c29e03b19e5..00000000000 --- a/llvm/test/Transforms/Mem2Reg/dbg-addr-inline-dse.ll +++ /dev/null @@ -1,94 +0,0 @@ -; RUN: opt -mem2reg -S < %s | FileCheck %s -implicit-check-not="call void @llvm.dbg.addr" - -; This example is intended to simulate this pass pipeline, which may not exist -; in practice: -; 1. DSE f from the original C source -; 2. Inline escape -; 3. mem2reg -; This exercises the corner case of multiple llvm.dbg.addr intrinsics. - -; C source: -; -; void escape(int *px) { ++*px; } -; extern int global; -; void f(int x) { -; escape(&x); -; x = 1; // DSE should delete and insert dbg.value(i32 1) -; global = x; -; x = 2; // DSE should insert dbg.addr -; escape(&x); -; } - -; ModuleID = 'dse.c' -source_filename = "dse.c" -target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-pc-windows-msvc19.0.24215" - -declare void @llvm.dbg.addr(metadata, metadata, metadata) #2 -declare void @llvm.dbg.value(metadata, metadata, metadata) #2 - -@global = external global i32, align 4 - -; Function Attrs: nounwind uwtable -define void @f(i32 %x) #0 !dbg !8 { -entry: - %x.addr = alloca i32, align 4 - store i32 %x, i32* %x.addr, align 4 - call void @llvm.dbg.addr(metadata i32* %x.addr, metadata !13, metadata !DIExpression()), !dbg !18 - %ld.1 = load i32, i32* %x.addr, align 4, !dbg !19 - %inc.1 = add nsw i32 %ld.1, 1, !dbg !19 - store i32 %inc.1, i32* %x.addr, align 4, !dbg !19 - call void @llvm.dbg.value(metadata i32 1, metadata !13, metadata !DIExpression()), !dbg !20 - store i32 1, i32* @global, align 4, !dbg !22 - call void @llvm.dbg.addr(metadata i32* %x.addr, metadata !13, metadata !DIExpression()), !dbg !23 - store i32 2, i32* %x.addr, align 4, !dbg !23 - %ld.2 = load i32, i32* %x.addr, align 4, !dbg !19 - %inc.2 = add nsw i32 %ld.2, 1, !dbg !19 - store i32 %inc.2, i32* %x.addr, align 4, !dbg !19 - ret void, !dbg !25 -} - -; CHECK-LABEL: define void @f(i32 %x) -; CHECK: call void @llvm.dbg.value(metadata i32 %x, metadata !13, metadata !DIExpression()) -; CHECK: %inc.1 = add nsw i32 %x, 1 -; CHECK: call void @llvm.dbg.value(metadata i32 %inc.1, metadata !13, metadata !DIExpression()) -; CHECK: call void @llvm.dbg.value(metadata i32 1, metadata !13, metadata !DIExpression()) -; CHECK: store i32 1, i32* @global, align 4 -; CHECK: call void @llvm.dbg.value(metadata i32 2, metadata !13, metadata !DIExpression()) -; CHECK: %inc.2 = add nsw i32 2, 1 -; CHECK: call void @llvm.dbg.value(metadata i32 %inc.2, metadata !13, metadata !DIExpression()) -; CHECK: ret void - -attributes #0 = { nounwind uwtable } -attributes #2 = { nounwind readnone speculatable } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3, !4, !5, !6} -!llvm.ident = !{!7} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) -!1 = !DIFile(filename: "dse.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild") -!2 = !{} -!3 = !{i32 2, !"Dwarf Version", i32 4} -!4 = !{i32 2, !"Debug Info Version", i32 3} -!5 = !{i32 1, !"wchar_size", i32 2} -!6 = !{i32 7, !"PIC Level", i32 2} -!7 = !{!"clang version 6.0.0 "} -!8 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 3, type: !9, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12) -!9 = !DISubroutineType(types: !10) -!10 = !{null, !11} -!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!12 = !{!13} -!13 = !DILocalVariable(name: "x", arg: 1, scope: !8, file: !1, line: 3, type: !11) -!14 = !{!15, !15, i64 0} -!15 = !{!"int", !16, i64 0} -!16 = !{!"omnipotent char", !17, i64 0} -!17 = !{!"Simple C/C++ TBAA"} -!18 = !DILocation(line: 3, column: 12, scope: !8) -!19 = !DILocation(line: 4, column: 3, scope: !8) -!20 = !DILocation(line: 5, column: 5, scope: !8) -!21 = !DILocation(line: 6, column: 12, scope: !8) -!22 = !DILocation(line: 6, column: 10, scope: !8) -!23 = !DILocation(line: 7, column: 5, scope: !8) -!24 = !DILocation(line: 8, column: 3, scope: !8) -!25 = !DILocation(line: 9, column: 1, scope: !8) diff --git a/llvm/test/Transforms/Mem2Reg/dbg-addr.ll b/llvm/test/Transforms/Mem2Reg/dbg-addr.ll deleted file mode 100644 index aaaeedcd12e..00000000000 --- a/llvm/test/Transforms/Mem2Reg/dbg-addr.ll +++ /dev/null @@ -1,91 +0,0 @@ -; RUN: opt -mem2reg -S < %s | FileCheck %s - -; ModuleID = 'newvars.c' -source_filename = "newvars.c" -target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-pc-windows-msvc19.0.24215" - -; Function Attrs: nounwind uwtable -define i32 @if_else(i32 %cond, i32 %a, i32 %b) !dbg !8 { -entry: - %x = alloca i32, align 4 - call void @llvm.dbg.addr(metadata i32* %x, metadata !16, metadata !DIExpression()), !dbg !26 - store i32 %a, i32* %x, align 4, !dbg !26, !tbaa !17 - %tobool = icmp ne i32 %cond, 0, !dbg !28 - br i1 %tobool, label %if.then, label %if.else, !dbg !30 - -if.then: ; preds = %entry - store i32 0, i32* %x, align 4, !dbg !31, !tbaa !17 - br label %if.end, !dbg !33 - -if.else: ; preds = %entry - store i32 %b, i32* %x, align 4, !dbg !36, !tbaa !17 - br label %if.end - -if.end: ; preds = %if.else, %if.then - %rv = load i32, i32* %x, align 4, !dbg !37, !tbaa !17 - ret i32 %rv, !dbg !39 -} - -; CHECK-LABEL: define i32 @if_else({{.*}}) -; CHECK: entry: -; CHECK-NOT: alloca i32 -; CHECK: call void @llvm.dbg.value(metadata i32 %a, metadata ![[X_LOCAL:[0-9]+]], metadata !DIExpression()) -; CHECK: if.then: ; preds = %entry -; CHECK: call void @llvm.dbg.value(metadata i32 0, metadata ![[X_LOCAL]], metadata !DIExpression()) -; CHECK: if.else: ; preds = %entry -; CHECK: call void @llvm.dbg.value(metadata i32 %b, metadata ![[X_LOCAL]], metadata !DIExpression()) -; CHECK: if.end: ; preds = %if.else, %if.then -; CHECK: %[[PHI:[^ ]*]] = phi i32 [ 0, %if.then ], [ %b, %if.else ] -; CHECK: call void @llvm.dbg.value(metadata i32 %[[PHI]], metadata ![[X_LOCAL]], metadata !DIExpression()) -; CHECK: ret i32 - -; CHECK: ![[X_LOCAL]] = !DILocalVariable(name: "x", {{.*}}) - -; Function Attrs: nounwind readnone speculatable -declare void @llvm.dbg.declare(metadata, metadata, metadata) -declare void @llvm.dbg.addr(metadata, metadata, metadata) - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3, !4, !5, !6} -!llvm.ident = !{!7} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) -!1 = !DIFile(filename: "newvars.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild") -!2 = !{} -!3 = !{i32 2, !"Dwarf Version", i32 4} -!4 = !{i32 2, !"Debug Info Version", i32 3} -!5 = !{i32 1, !"wchar_size", i32 2} -!6 = !{i32 7, !"PIC Level", i32 2} -!7 = !{!"clang version 6.0.0 "} -!8 = distinct !DISubprogram(name: "if_else", scope: !1, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12) -!9 = !DISubroutineType(types: !10) -!10 = !{!11, !11, !11, !11} -!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!12 = !{!13, !14, !15, !16} -!13 = !DILocalVariable(name: "b", arg: 3, scope: !8, file: !1, line: 1, type: !11) -!14 = !DILocalVariable(name: "a", arg: 2, scope: !8, file: !1, line: 1, type: !11) -!15 = !DILocalVariable(name: "cond", arg: 1, scope: !8, file: !1, line: 1, type: !11) -!16 = !DILocalVariable(name: "x", scope: !8, file: !1, line: 2, type: !11) -!17 = !{!18, !18, i64 0} -!18 = !{!"int", !19, i64 0} -!19 = !{!"omnipotent char", !20, i64 0} -!20 = !{!"Simple C/C++ TBAA"} -!22 = !DILocation(line: 1, column: 34, scope: !8) -!23 = !DILocation(line: 1, column: 27, scope: !8) -!24 = !DILocation(line: 1, column: 17, scope: !8) -!25 = !DILocation(line: 2, column: 3, scope: !8) -!26 = !DILocation(line: 2, column: 7, scope: !8) -!27 = !DILocation(line: 2, column: 11, scope: !8) -!28 = !DILocation(line: 3, column: 7, scope: !29) -!29 = distinct !DILexicalBlock(scope: !8, file: !1, line: 3, column: 7) -!30 = !DILocation(line: 3, column: 7, scope: !8) -!31 = !DILocation(line: 4, column: 7, scope: !32) -!32 = distinct !DILexicalBlock(scope: !29, file: !1, line: 3, column: 13) -!33 = !DILocation(line: 5, column: 3, scope: !32) -!34 = !DILocation(line: 6, column: 9, scope: !35) -!35 = distinct !DILexicalBlock(scope: !29, file: !1, line: 5, column: 10) -!36 = !DILocation(line: 6, column: 7, scope: !35) -!37 = !DILocation(line: 8, column: 10, scope: !8) -!38 = !DILocation(line: 9, column: 1, scope: !8) -!39 = !DILocation(line: 8, column: 3, scope: !8) diff --git a/llvm/test/Transforms/Mem2Reg/dbg-inline-scope-for-phi.ll b/llvm/test/Transforms/Mem2Reg/dbg-inline-scope-for-phi.ll deleted file mode 100644 index 6f4c33b9e5f..00000000000 --- a/llvm/test/Transforms/Mem2Reg/dbg-inline-scope-for-phi.ll +++ /dev/null @@ -1,110 +0,0 @@ -; RUN: opt -S < %s -mem2reg -verify | FileCheck %s - -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.13.0" - -; Original source (with some whitespace removed): -; -; extern int *getp(); -; extern int cond(); -; int get1() { return *getp(); } -; int get2(int *p) { return *p; } -; int bug(int *p) { -; if (cond()) return get1(); -; else return get2(p); -; } - -define i32 @get1() !dbg !8 { - %1 = call i32* (...) @getp(), !dbg !12 - %2 = load i32, i32* %1, align 4, !dbg !13 - ret i32 %2, !dbg !14 -} - -declare i32* @getp(...) - -define i32 @get2(i32*) !dbg !15 { - %2 = alloca i32*, align 8 - store i32* %0, i32** %2, align 8 - call void @llvm.dbg.declare(metadata i32** %2, metadata !19, metadata !DIExpression()), !dbg !20 - %3 = load i32*, i32** %2, align 8, !dbg !21 - %4 = load i32, i32* %3, align 4, !dbg !22 - ret i32 %4, !dbg !23 -} - -declare void @llvm.dbg.declare(metadata, metadata, metadata) - -; CHECK-LABEL: define i32 @bug -define i32 @bug(i32*) !dbg !24 { - %2 = alloca i32, align 4 - %3 = alloca i32*, align 8 - store i32* %0, i32** %3, align 8 - call void @llvm.dbg.declare(metadata i32** %3, metadata !25, metadata !DIExpression()), !dbg !26 - %4 = call i32 (...) @cond(), !dbg !27 - %5 = icmp ne i32 %4, 0, !dbg !27 - br i1 %5, label %6, label %8, !dbg !29 - -; <label>:6: ; preds = %1 - %7 = call i32 @get1(), !dbg !30 - store i32 %7, i32* %2, align 4, !dbg !31 - br label %11, !dbg !31 - -; <label>:8: ; preds = %1 - %9 = load i32*, i32** %3, align 8, !dbg !32 - %10 = call i32 @get2(i32* %9), !dbg !33 - store i32 %10, i32* %2, align 4, !dbg !34 - br label %11, !dbg !34 - -; <label>:11: ; preds = %8, %6 - %12 = load i32, i32* %2, align 4, !dbg !35 - ret i32 %12, !dbg !35 - - ; CHECK: [[phi:%.*]] = phi i32 [ {{.*}} ], [ {{.*}} ], !dbg [[mergedLoc:![0-9]+]] - ; CHECK-NEXT: ret i32 [[phi]], !dbg [[retLoc:![0-9]+]] -} - -; CHECK: [[commonScope:![0-9]+]] = distinct !DILexicalBlock(scope: {{.*}}, file: !1, line: 15, column: 7) -; CHECK: [[mergedLoc]] = !DILocation(line: 0, scope: [[commonScope]]) -; CHECK: [[retLoc]] = !DILocation(line: 23, column: 1 - -declare i32 @cond(...) - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3, !4, !5, !6} -!llvm.ident = !{!7} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Apple LLVM version 9.1.0 (clang-902.2.37.2)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) -!1 = !DIFile(filename: "bug.c", directory: "/bug") -!2 = !{} -!3 = !{i32 2, !"Dwarf Version", i32 4} -!4 = !{i32 2, !"Debug Info Version", i32 3} -!5 = !{i32 1, !"wchar_size", i32 4} -!6 = !{i32 7, !"PIC Level", i32 2} -!7 = !{!"Apple LLVM version 9.1.0 (clang-902.2.37.2)"} -!8 = distinct !DISubprogram(name: "get1", scope: !1, file: !1, line: 6, type: !9, isLocal: false, isDefinition: true, scopeLine: 6, isOptimized: false, unit: !0, retainedNodes: !2) -!9 = !DISubroutineType(types: !10) -!10 = !{!11} -!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!12 = !DILocation(line: 7, column: 11, scope: !8) -!13 = !DILocation(line: 7, column: 10, scope: !8) -!14 = !DILocation(line: 7, column: 3, scope: !8) -!15 = distinct !DISubprogram(name: "get2", scope: !1, file: !1, line: 10, type: !16, isLocal: false, isDefinition: true, scopeLine: 10, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) -!16 = !DISubroutineType(types: !17) -!17 = !{!11, !18} -!18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64) -!19 = !DILocalVariable(name: "p", arg: 1, scope: !15, file: !1, line: 10, type: !18) -!20 = !DILocation(line: 10, column: 15, scope: !15) -!21 = !DILocation(line: 11, column: 11, scope: !15) -!22 = !DILocation(line: 11, column: 10, scope: !15) -!23 = !DILocation(line: 11, column: 3, scope: !15) -!24 = distinct !DISubprogram(name: "bug", scope: !1, file: !1, line: 14, type: !16, isLocal: false, isDefinition: true, scopeLine: 14, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) -!25 = !DILocalVariable(name: "p", arg: 1, scope: !24, file: !1, line: 14, type: !18) -!26 = !DILocation(line: 14, column: 14, scope: !24) -!27 = !DILocation(line: 15, column: 7, scope: !28) -!28 = distinct !DILexicalBlock(scope: !24, file: !1, line: 15, column: 7) -!29 = !DILocation(line: 15, column: 7, scope: !24) -!30 = !DILocation(line: 16, column: 12, scope: !28) -!31 = !DILocation(line: 16, column: 5, scope: !28) -!32 = !DILocation(line: 18, column: 17, scope: !28) -!33 = !DILocation(line: 18, column: 12, scope: !28) -!34 = !DILocation(line: 18, column: 5, scope: !28) -!35 = !DILocation(line: 23, column: 1, scope: !24) diff --git a/llvm/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll b/llvm/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll deleted file mode 100644 index 82144cb228e..00000000000 --- a/llvm/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll +++ /dev/null @@ -1,46 +0,0 @@ -; RUN: opt < %s -mem2reg -S | FileCheck %s -source_filename = "bugpoint-output.bc" -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.12.0" - -define void @scan() #0 !dbg !12 { -entry: - %entry1 = alloca i1, align 8 - call void @llvm.dbg.declare(metadata i1* %entry1, metadata !18, metadata !19), !dbg !20 - store i1 0, i1* %entry1, align 8, !dbg !20 - br label %for.cond, !dbg !20 - -for.cond: -; CHECK: %[[PHI:.*]] = phi i1 [ false, %entry ], [ %0, %for.cond ] - %entryN = load i1, i1* %entry1, align 8, !dbg !20 -; CHECK: call void @llvm.dbg.value(metadata i1 %[[PHI]], -; CHECK-SAME: metadata !DIExpression()) - %0 = add i1 %entryN, 1 -; CHECK: %0 = add i1 %[[PHI]], true -; CHECK: call void @llvm.dbg.value(metadata i1 %0, -; CHECK-SAME: metadata !DIExpression()) - store i1 %0, i1* %entry1, align 8, !dbg !20 - br label %for.cond, !dbg !20 -} - -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -attributes #0 = { nounwind ssp uwtable } -attributes #1 = { nounwind readnone } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!10, !11} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "adrian", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug) -!1 = !DIFile(filename: "<stdin>", directory: "/") -!2 = !{} -!4 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) -!10 = !{i32 2, !"Debug Info Version", i32 3} -!11 = !{i32 1, !"PIC Level", i32 2} -!12 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !13, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !15) -!13 = !DISubroutineType(types: !14) -!14 = !{null, !4, !4} -!15 = !{!18} -!18 = !DILocalVariable(name: "entry", scope: !12, file: !1, line: 6, type: !4) -!19 = !DIExpression() -!20 = !DILocation(line: 6, scope: !12) diff --git a/llvm/test/Transforms/Mem2Reg/debug-alloca-phi.ll b/llvm/test/Transforms/Mem2Reg/debug-alloca-phi.ll deleted file mode 100644 index 23365f75d9b..00000000000 --- a/llvm/test/Transforms/Mem2Reg/debug-alloca-phi.ll +++ /dev/null @@ -1,46 +0,0 @@ -; RUN: opt < %s -mem2reg -S | FileCheck %s -source_filename = "bugpoint-output.bc" -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.12.0" - -define void @scan() #0 !dbg !12 { -entry: - %entry1 = alloca i8, align 8 - call void @llvm.dbg.declare(metadata i8* %entry1, metadata !18, metadata !19), !dbg !20 - store i8 0, i8* %entry1, align 8, !dbg !20 - br label %for.cond, !dbg !20 - -for.cond: -; CHECK: %[[PHI:.*]] = phi i8 [ 0, %entry ], [ %0, %for.cond ] - %entryN = load i8, i8* %entry1, align 8, !dbg !20 -; CHECK: call void @llvm.dbg.value(metadata i8 %[[PHI]], -; CHECK-SAME: metadata !DIExpression()) - %0 = add i8 %entryN, 1 -; CHECK: %0 = add i8 %[[PHI]], 1 -; CHECK: call void @llvm.dbg.value(metadata i8 %0, -; CHECK-SAME: metadata !DIExpression()) - store i8 %0, i8* %entry1, align 8, !dbg !20 - br label %for.cond, !dbg !20 -} - -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -attributes #0 = { nounwind ssp uwtable } -attributes #1 = { nounwind readnone } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!10, !11} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "adrian", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug) -!1 = !DIFile(filename: "<stdin>", directory: "/") -!2 = !{} -!4 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) -!10 = !{i32 2, !"Debug Info Version", i32 3} -!11 = !{i32 1, !"PIC Level", i32 2} -!12 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !13, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !15) -!13 = !DISubroutineType(types: !14) -!14 = !{null, !4, !4} -!15 = !{!18} -!18 = !DILocalVariable(name: "entry", scope: !12, file: !1, line: 6, type: !4) -!19 = !DIExpression() -!20 = !DILocation(line: 6, scope: !12) diff --git a/llvm/test/Transforms/Mem2Reg/debug-alloca-vla-1.ll b/llvm/test/Transforms/Mem2Reg/debug-alloca-vla-1.ll deleted file mode 100644 index 6a2419c03e4..00000000000 --- a/llvm/test/Transforms/Mem2Reg/debug-alloca-vla-1.ll +++ /dev/null @@ -1,62 +0,0 @@ -; RUN: opt < %s -mem2reg -S | FileCheck %s - -; Testing conversion from dbg.declare to dbg.value when the variable is a VLA. -; -; We can't derive the size of the variable simply by looking at the -; metadata. But we can find out the size by examining the alloca, so we should -; know that the load/store instructions are referencing the whole variable, -; and we expect to get dbg.value intrinsics that maps %entryN (aka %[[PHI]]) -; and %t0 to the variable allocated as %vla1. - -; ModuleID = 'debug-alloca-vla.ll' -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.12.0" - -; Function Attrs: nounwind ssp uwtable -define void @scan() #0 !dbg !4 { -entry: - %vla1 = alloca i32, i32 1, align 8 - call void @llvm.dbg.declare(metadata i32* %vla1, metadata !10, metadata !DIExpression()), !dbg !18 - br label %for.cond, !dbg !18 - -for.cond: ; preds = %for.cond, %entry -; CHECK: %[[PHI:.*]] = phi i32 [ undef, %entry ], [ %t0, %for.cond ] - %entryN = load i32, i32* %vla1, align 8, !dbg !18 -; CHECK: call void @llvm.dbg.value(metadata i32 %[[PHI]], -; CHECK-SAME: metadata !DIExpression()) - %t0 = add i32 %entryN, 1 -; CHECK: %t0 = add i32 %[[PHI]], 1 -; CHECK: call void @llvm.dbg.value(metadata i32 %t0, -; CHECK-SAME: metadata !DIExpression()) - store i32 %t0, i32* %vla1, align 8, !dbg !18 - br label %for.cond, !dbg !18 -} - -; Function Attrs: nounwind readnone speculatable -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -attributes #0 = { nounwind ssp uwtable } -attributes #1 = { nounwind readnone speculatable } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!2, !3} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "adrian", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug) -!1 = !DIFile(filename: "<stdin>", directory: "/") -!2 = !{i32 2, !"Debug Info Version", i32 3} -!3 = !{i32 7, !"PIC Level", i32 2} -!4 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !8) -!5 = !DISubroutineType(types: !6) -!6 = !{null, !7, !7} -!7 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) -!8 = !{!9} -!9 = !DILocalVariable(name: "entry", scope: !4, file: !1, line: 6, type: !7) -!10 = !DILocalVariable(name: "ptr32", scope: !4, file: !1, line: 240, type: !11) -!11 = !DICompositeType(tag: DW_TAG_array_type, baseType: !12, elements: !14) -!12 = !DIDerivedType(tag: DW_TAG_typedef, name: "__uint32_t", file: !1, line: 41, baseType: !13) -!13 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) -!14 = !{!15} -!15 = !DISubrange(count: !16) -!16 = !DILocalVariable(name: "__vla_expr", scope: !4, type: !17, flags: DIFlagArtificial) -!17 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned) -!18 = !DILocation(line: 6, scope: !4) diff --git a/llvm/test/Transforms/Mem2Reg/debug-alloca-vla-2.ll b/llvm/test/Transforms/Mem2Reg/debug-alloca-vla-2.ll deleted file mode 100644 index 0d7d2e34c81..00000000000 --- a/llvm/test/Transforms/Mem2Reg/debug-alloca-vla-2.ll +++ /dev/null @@ -1,64 +0,0 @@ -; RUN: opt < %s -mem2reg -S | FileCheck %s - -; Testing conversion from dbg.declare to dbg.value when the variable is a VLA. -; -; We can't derive the size of the variable since it is a VLA with an unknown -; number of element. -; -; Verify that we do not get a dbg.value after the phi node (we can't know if -; the phi nodes result describes the whole array or not). Also verify that we -; get a dbg.value that says that we do not know the value of the VLA in place -; of the store (since we do not know which part of the VLA the store is -; writing to). - -; ModuleID = 'debug-alloca-vla.ll' -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.12.0" - -; Function Attrs: nounwind ssp uwtable -define void @scan(i32 %n) #0 !dbg !4 { -entry: - %vla1 = alloca i32, i32 %n, align 8 - call void @llvm.dbg.declare(metadata i32* %vla1, metadata !10, metadata !DIExpression()), !dbg !18 - br label %for.cond, !dbg !18 - -for.cond: ; preds = %for.cond, %entry -; CHECK: %[[PHI:.*]] = phi i32 [ undef, %entry ], [ %t0, %for.cond ] - %entryN = load i32, i32* %vla1, align 8, !dbg !18 -; CHECK-NOT: call void @llvm.dbg.value - %t0 = add i32 %entryN, 1 -; CHECK: %t0 = add i32 %[[PHI]], 1 -; CHECK: call void @llvm.dbg.value(metadata i32 undef, -; CHECK-SAME: metadata !DIExpression()) - store i32 %t0, i32* %vla1, align 8, !dbg !18 - br label %for.cond, !dbg !18 -} - -; Function Attrs: nounwind readnone speculatable -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -attributes #0 = { nounwind ssp uwtable } -attributes #1 = { nounwind readnone speculatable } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!2, !3} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "adrian", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug) -!1 = !DIFile(filename: "<stdin>", directory: "/") -!2 = !{i32 2, !"Debug Info Version", i32 3} -!3 = !{i32 7, !"PIC Level", i32 2} -!4 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !8) -!5 = !DISubroutineType(types: !6) -!6 = !{null, !7, !7} -!7 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) -!8 = !{!9} -!9 = !DILocalVariable(name: "entry", scope: !4, file: !1, line: 6, type: !7) -!10 = !DILocalVariable(name: "ptr32", scope: !4, file: !1, line: 240, type: !11) -!11 = !DICompositeType(tag: DW_TAG_array_type, baseType: !12, elements: !14) -!12 = !DIDerivedType(tag: DW_TAG_typedef, name: "__uint32_t", file: !1, line: 41, baseType: !13) -!13 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) -!14 = !{!15} -!15 = !DISubrange(count: !16) -!16 = !DILocalVariable(name: "__vla_expr", scope: !4, type: !17, flags: DIFlagArtificial) -!17 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned) -!18 = !DILocation(line: 6, scope: !4) diff --git a/llvm/test/Transforms/Mem2Reg/ignore-lifetime.ll b/llvm/test/Transforms/Mem2Reg/ignore-lifetime.ll deleted file mode 100644 index b996a659237..00000000000 --- a/llvm/test/Transforms/Mem2Reg/ignore-lifetime.ll +++ /dev/null @@ -1,26 +0,0 @@ -; RUN: opt -mem2reg -S -o - < %s | FileCheck %s - -declare void @llvm.lifetime.start.p0i8(i64 %size, i8* nocapture %ptr) -declare void @llvm.lifetime.end.p0i8(i64 %size, i8* nocapture %ptr) - -define void @test1() { -; CHECK: test1 -; CHECK-NOT: alloca - %A = alloca i32 - %B = bitcast i32* %A to i8* - call void @llvm.lifetime.start.p0i8(i64 2, i8* %B) - store i32 1, i32* %A - call void @llvm.lifetime.end.p0i8(i64 2, i8* %B) - ret void -} - -define void @test2() { -; CHECK: test2 -; CHECK-NOT: alloca - %A = alloca {i8, i16} - %B = getelementptr {i8, i16}, {i8, i16}* %A, i32 0, i32 0 - call void @llvm.lifetime.start.p0i8(i64 2, i8* %B) - store {i8, i16} zeroinitializer, {i8, i16}* %A - call void @llvm.lifetime.end.p0i8(i64 2, i8* %B) - ret void -} diff --git a/llvm/test/Transforms/Mem2Reg/optnone.ll b/llvm/test/Transforms/Mem2Reg/optnone.ll deleted file mode 100644 index 41ee77aff79..00000000000 --- a/llvm/test/Transforms/Mem2Reg/optnone.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: opt < %s -mem2reg -S | FileCheck %s - -; This function is optnone, so the allocas should not be eliminated. - -; CHECK-LABEL: @testfunc -; CHECK: alloca -; CHECK: alloca -define double @testfunc(i32 %i, double %j) optnone noinline { - %I = alloca i32 ; <i32*> [#uses=4] - %J = alloca double ; <double*> [#uses=2] - store i32 %i, i32* %I - store double %j, double* %J - %t1 = load i32, i32* %I ; <i32> [#uses=1] - %t2 = add i32 %t1, 1 ; <i32> [#uses=1] - store i32 %t2, i32* %I - %t3 = load i32, i32* %I ; <i32> [#uses=1] - %t4 = sitofp i32 %t3 to double ; <double> [#uses=1] - %t5 = load double, double* %J ; <double> [#uses=1] - %t6 = fmul double %t4, %t5 ; <double> [#uses=1] - ret double %t6 -} diff --git a/llvm/test/Transforms/Mem2Reg/pr24179.ll b/llvm/test/Transforms/Mem2Reg/pr24179.ll deleted file mode 100644 index 72a9e61938d..00000000000 --- a/llvm/test/Transforms/Mem2Reg/pr24179.ll +++ /dev/null @@ -1,45 +0,0 @@ -; RUN: opt -mem2reg < %s -S | FileCheck %s -; RUN: opt -passes=mem2reg < %s -S | FileCheck %s - -declare i32 @def(i32) -declare i1 @use(i32) - -; Special case of a single-BB alloca does not apply here since the load -; is affected by the following store. Expect this case to be identified -; and a PHI node to be created. -define void @test1() { -; CHECK-LABEL: @test1( - entry: - %t = alloca i32 - br label %loop - - loop: - %v = load i32, i32* %t - %c = call i1 @use(i32 %v) -; CHECK: [[PHI:%.*]] = phi i32 [ undef, %entry ], [ %n, %loop ] -; CHECK: call i1 @use(i32 [[PHI]]) - %n = call i32 @def(i32 7) - store i32 %n, i32* %t - br i1 %c, label %loop, label %exit - - exit: - ret void -} - -; Same as above, except there is no following store. The alloca should just be -; replaced with an undef -define void @test2() { -; CHECK-LABEL: @test2( - entry: - %t = alloca i32 - br label %loop - - loop: - %v = load i32, i32* %t - %c = call i1 @use(i32 %v) -; CHECK: %c = call i1 @use(i32 undef) - br i1 %c, label %loop, label %exit - - exit: - ret void -} diff --git a/llvm/test/Transforms/Mem2Reg/pr37632-unreachable-list-of-stores.ll b/llvm/test/Transforms/Mem2Reg/pr37632-unreachable-list-of-stores.ll deleted file mode 100644 index bb4c0f1d57f..00000000000 --- a/llvm/test/Transforms/Mem2Reg/pr37632-unreachable-list-of-stores.ll +++ /dev/null @@ -1,20 +0,0 @@ -; RUN: opt -mem2reg < %s -S | FileCheck %s - - -; CHECK-LABEL: void @patatino() -; CHECK-NEXT: ret void - -; CHECK-LABEL: cantreachme: -; CHECK-NEXT: %dec = add nsw i32 undef, -1 -; CHECK-NEXT: br label %cantreachme - -define void @patatino() { - %a = alloca i32, align 4 - ret void -cantreachme: - %dec = add nsw i32 %tmp, -1 - store i32 %dec, i32* %a - store i32 %tmp, i32* %a - %tmp = load i32, i32* %a - br label %cantreachme -} diff --git a/llvm/test/Transforms/Mem2Reg/preserve-nonnull-load-metadata.ll b/llvm/test/Transforms/Mem2Reg/preserve-nonnull-load-metadata.ll deleted file mode 100644 index 33a5b124c55..00000000000 --- a/llvm/test/Transforms/Mem2Reg/preserve-nonnull-load-metadata.ll +++ /dev/null @@ -1,89 +0,0 @@ -; RUN: opt < %s -mem2reg -S | FileCheck %s - -; This tests that mem2reg preserves the !nonnull metadata on loads -; from allocas that get optimized out. - -; Check the case where the alloca in question has a single store. -define float* @single_store(float** %arg) { -; CHECK-LABEL: define float* @single_store -; CHECK: %arg.load = load float*, float** %arg, align 8 -; CHECK: [[ASSUME:%(.*)]] = icmp ne float* %arg.load, null -; CHECK: call void @llvm.assume(i1 {{.*}}[[ASSUME]]) -; CHECK: ret float* %arg.load -entry: - %buf = alloca float* - %arg.load = load float*, float** %arg, align 8 - store float* %arg.load, float** %buf, align 8 - %buf.load = load float*, float **%buf, !nonnull !0 - ret float* %buf.load -} - -; Check the case where the alloca in question has more than one -; store but still within one basic block. -define float* @single_block(float** %arg) { -; CHECK-LABEL: define float* @single_block -; CHECK: %arg.load = load float*, float** %arg, align 8 -; CHECK: [[ASSUME:%(.*)]] = icmp ne float* %arg.load, null -; CHECK: call void @llvm.assume(i1 {{.*}}[[ASSUME]]) -; CHECK: ret float* %arg.load -entry: - %buf = alloca float* - %arg.load = load float*, float** %arg, align 8 - store float* null, float** %buf, align 8 - store float* %arg.load, float** %buf, align 8 - %buf.load = load float*, float **%buf, !nonnull !0 - ret float* %buf.load -} - -; Check the case where the alloca in question has more than one -; store and also reads ands writes in multiple blocks. -define float* @multi_block(float** %arg) { -; CHECK-LABEL: define float* @multi_block -; CHECK-LABEL: entry: -; CHECK: %arg.load = load float*, float** %arg, align 8 -; CHECK: br label %next -; CHECK-LABEL: next: -; CHECK: [[ASSUME:%(.*)]] = icmp ne float* %arg.load, null -; CHECK: call void @llvm.assume(i1 {{.*}}[[ASSUME]]) -; CHECK: ret float* %arg.load -entry: - %buf = alloca float* - %arg.load = load float*, float** %arg, align 8 - store float* null, float** %buf, align 8 - br label %next -next: - store float* %arg.load, float** %buf, align 8 - %buf.load = load float*, float** %buf, !nonnull !0 - ret float* %buf.load -} - -; Check that we don't add an assume if it's not -; necessary i.e. the value is already implied to be nonnull -define float* @no_assume(float** %arg) { -; CHECK-LABEL: define float* @no_assume -; CHECK-LABEL: entry: -; CHECK: %arg.load = load float*, float** %arg, align 8 -; CHECK: %cn = icmp ne float* %arg.load, null -; CHECK: br i1 %cn, label %next, label %fin -; CHECK-LABEL: next: -; CHECK-NOT: call void @llvm.assume -; CHECK: ret float* %arg.load -; CHECK-LABEL: fin: -; CHECK: ret float* null -entry: - %buf = alloca float* - %arg.load = load float*, float** %arg, align 8 - %cn = icmp ne float* %arg.load, null - br i1 %cn, label %next, label %fin -next: -; At this point the above nonnull check ensures that -; the value %arg.load is nonnull in this block and thus -; we need not add the assume. - store float* %arg.load, float** %buf, align 8 - %buf.load = load float*, float** %buf, !nonnull !0 - ret float* %buf.load -fin: - ret float* null -} - -!0 = !{} diff --git a/llvm/test/Transforms/Mem2Reg/undef-order.ll b/llvm/test/Transforms/Mem2Reg/undef-order.ll deleted file mode 100644 index 09687518c87..00000000000 --- a/llvm/test/Transforms/Mem2Reg/undef-order.ll +++ /dev/null @@ -1,53 +0,0 @@ -;RUN: opt -mem2reg -S < %s | FileCheck %s - -declare i1 @cond() - -define i32 @foo() { -Entry: - %val = alloca i32 - %c1 = call i1 @cond() - br i1 %c1, label %Store1, label %Store2 -Block1: - br label %Join -Block2: - br label %Join -Block3: - br label %Join -Block4: - br label %Join -Block5: - br label %Join -Store1: - store i32 1, i32* %val - br label %Join -Block6: - br label %Join -Block7: - br label %Join -Block8: - br label %Join -Block9: - br label %Join -Block10: - br label %Join -Store2: - store i32 2, i32* %val - br label %Join -Block11: - br label %Join -Block12: - br label %Join -Block13: - br label %Join -Block14: - br label %Join -Block15: - br label %Join -Block16: - br label %Join -Join: -; Phi inserted here should have operands appended deterministically -; CHECK: %val.0 = phi i32 [ 1, %Store1 ], [ 2, %Store2 ], [ undef, %Block1 ], [ undef, %Block2 ], [ undef, %Block3 ], [ undef, %Block4 ], [ undef, %Block5 ], [ undef, %Block6 ], [ undef, %Block7 ], [ undef, %Block8 ], [ undef, %Block9 ], [ undef, %Block10 ], [ undef, %Block11 ], [ undef, %Block12 ], [ undef, %Block13 ], [ undef, %Block14 ], [ undef, %Block15 ], [ undef, %Block16 ] - %result = load i32, i32* %val - ret i32 %result -} |