diff --git a/llvm/test/Transforms/Inline/alloca-dbgdeclare-merge.ll b/llvm/test/Transforms/Inline/alloca-dbgdeclare-merge.ll deleted file mode 100644 --- a/llvm/test/Transforms/Inline/alloca-dbgdeclare-merge.ll +++ /dev/null @@ -1,107 +0,0 @@ -; Test that alloca merging in the inliner places dbg.declare calls after the -; merged alloca, but does not otherwise reorder them. -; -; clang -g -S -emit-llvm -Xclang -disable-llvm-optzns -; -;__attribute__((always_inline)) void f() { -; char aaa[100]; -; aaa[10] = 1; -;} -; -;__attribute__((always_inline)) void g() { -; char bbb[100]; -; bbb[20] = 1; -;} -; -;void h() { -; f(); -; g(); -;} -; -; RUN: opt -always-inline -S -enable-new-pm=0 < %s | FileCheck %s - -; FIXME: Why does the dbg.declare for "aaa" occur later in @h than the -; dbg.declare for "bbb"? I'd expect the opposite, given @f is inlined earlier. -; -; CHECK: define void @h() -; CHECK-NEXT: entry: -; CHECK-NEXT: %[[AI:.*]] = alloca [100 x i8] -; CHECK-NEXT: call void @llvm.dbg.declare(metadata [100 x i8]* %[[AI]], metadata [[BBB:![0-9]+]] -; CHECK-NEXT: bitcast -; CHECK-NEXT: llvm.lifetime.start -; CHECK-NEXT: call void @llvm.dbg.declare(metadata [100 x i8]* %[[AI]], metadata [[AAA:![0-9]+]] - -; CHECK: [[AAA]] = !DILocalVariable(name: "aaa" -; CHECK: [[BBB]] = !DILocalVariable(name: "bbb" - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; Function Attrs: alwaysinline nounwind uwtable -define void @f() #0 !dbg !4 { -entry: - %aaa = alloca [100 x i8], align 16 - call void @llvm.dbg.declare(metadata [100 x i8]* %aaa, metadata !12, metadata !17), !dbg !18 - %arrayidx = getelementptr inbounds [100 x i8], [100 x i8]* %aaa, i64 0, i64 10, !dbg !19 - store i8 1, i8* %arrayidx, align 2, !dbg !20 - ret void, !dbg !21 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -; Function Attrs: alwaysinline nounwind uwtable -define void @g() #0 !dbg !7 { -entry: - %bbb = alloca [100 x i8], align 16 - call void @llvm.dbg.declare(metadata [100 x i8]* %bbb, metadata !22, metadata !17), !dbg !23 - %arrayidx = getelementptr inbounds [100 x i8], [100 x i8]* %bbb, i64 0, i64 20, !dbg !24 - store i8 1, i8* %arrayidx, align 4, !dbg !25 - ret void, !dbg !26 -} - -; Function Attrs: nounwind uwtable -define void @h() #2 !dbg !8 { -entry: - call void @f(), !dbg !27 - call void @g(), !dbg !28 - ret void, !dbg !29 -} - -attributes #0 = { alwaysinline nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind readnone } -attributes #2 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!9, !10} -!llvm.ident = !{!11} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 248518) (llvm/trunk 248512)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) -!1 = !DIFile(filename: "../1.c", directory: "/code/llvm-git/build") -!2 = !{} -!4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0, retainedNodes: !2) -!5 = !DISubroutineType(types: !6) -!6 = !{null} -!7 = distinct !DISubprogram(name: "g", scope: !1, file: !1, line: 6, type: !5, isLocal: false, isDefinition: true, scopeLine: 6, isOptimized: false, unit: !0, retainedNodes: !2) -!8 = distinct !DISubprogram(name: "h", scope: !1, file: !1, line: 11, type: !5, isLocal: false, isDefinition: true, scopeLine: 11, isOptimized: false, unit: !0, retainedNodes: !2) -!9 = !{i32 2, !"Dwarf Version", i32 4} -!10 = !{i32 2, !"Debug Info Version", i32 3} -!11 = !{!"clang version 3.8.0 (trunk 248518) (llvm/trunk 248512)"} -!12 = !DILocalVariable(name: "aaa", scope: !4, file: !1, line: 2, type: !13) -!13 = !DICompositeType(tag: DW_TAG_array_type, baseType: !14, size: 800, align: 8, elements: !15) -!14 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) -!15 = !{!16} -!16 = !DISubrange(count: 100) -!17 = !DIExpression() -!18 = !DILocation(line: 2, column: 8, scope: !4) -!19 = !DILocation(line: 3, column: 3, scope: !4) -!20 = !DILocation(line: 3, column: 11, scope: !4) -!21 = !DILocation(line: 4, column: 1, scope: !4) -!22 = !DILocalVariable(name: "bbb", scope: !7, file: !1, line: 7, type: !13) -!23 = !DILocation(line: 7, column: 8, scope: !7) -!24 = !DILocation(line: 8, column: 3, scope: !7) -!25 = !DILocation(line: 8, column: 11, scope: !7) -!26 = !DILocation(line: 9, column: 1, scope: !7) -!27 = !DILocation(line: 12, column: 3, scope: !8) -!28 = !DILocation(line: 13, column: 3, scope: !8) -!29 = !DILocation(line: 14, column: 1, scope: !8) diff --git a/llvm/test/Transforms/Inline/alloca-merge-align.ll b/llvm/test/Transforms/Inline/alloca-merge-align.ll deleted file mode 100644 --- a/llvm/test/Transforms/Inline/alloca-merge-align.ll +++ /dev/null @@ -1,104 +0,0 @@ -; RUN: opt < %s -inline -S -enable-new-pm=0 | FileCheck %s - -target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64" -target triple = "powerpc64-unknown-linux-gnu" - -%struct.s = type { i32, i32 } - -define void @foo(%struct.s* byval(%struct.s) nocapture readonly %a) { -entry: - %x = alloca [2 x i32], align 4 - %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0 - %0 = load i32, i32* %a1, align 4 - %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0 - store i32 %0, i32* %arrayidx, align 4 - %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1 - %1 = load i32, i32* %b, align 4 - %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1 - store i32 %1, i32* %arrayidx2, align 4 - call void @bar(i32* %arrayidx) #2 - ret void -} - -define void @foo0(%struct.s* byval(%struct.s) nocapture readonly %a) { -entry: - %x = alloca [2 x i32] - %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0 - %0 = load i32, i32* %a1, align 4 - %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0 - store i32 %0, i32* %arrayidx, align 4 - %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1 - %1 = load i32, i32* %b, align 4 - %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1 - store i32 %1, i32* %arrayidx2, align 4 - call void @bar(i32* %arrayidx) #2 - ret void -} - -define void @foo1(%struct.s* byval(%struct.s) nocapture readonly %a) { -entry: - %x = alloca [2 x i32], align 1 - %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0 - %0 = load i32, i32* %a1, align 4 - %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0 - store i32 %0, i32* %arrayidx, align 4 - %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1 - %1 = load i32, i32* %b, align 4 - %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1 - store i32 %1, i32* %arrayidx2, align 4 - call void @bar(i32* %arrayidx) #2 - ret void -} - -declare void @bar(i32*) #1 - -define void @goo(%struct.s* byval(%struct.s) nocapture readonly %a) { -entry: - %x = alloca [2 x i32], align 32 - %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0 - %0 = load i32, i32* %a1, align 4 - %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0 - store i32 %0, i32* %arrayidx, align 32 - %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1 - %1 = load i32, i32* %b, align 4 - %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1 - store i32 %1, i32* %arrayidx2, align 4 - call void @bar(i32* %arrayidx) #2 - ret void -} - -; CHECK-LABEL: @main -; CHECK: alloca [2 x i32], align 32 -; CHECK-NOT: alloca [2 x i32] -; CHECK: ret i32 0 - -define signext i32 @main() { -entry: - %a = alloca i64, align 8 - %tmpcast = bitcast i64* %a to %struct.s* - store i64 0, i64* %a, align 8 - %a1 = bitcast i64* %a to i32* - store i32 1, i32* %a1, align 8 - call void @foo(%struct.s* byval(%struct.s) %tmpcast) - store i32 2, i32* %a1, align 8 - call void @goo(%struct.s* byval(%struct.s) %tmpcast) - ret i32 0 -} - -; CHECK-LABEL: @test0 -; CHECK: alloca [2 x i32], align 32 -; CHECK-NOT: alloca [2 x i32] -; CHECK: ret i32 0 - -define signext i32 @test0() { -entry: - %a = alloca i64, align 8 - %tmpcast = bitcast i64* %a to %struct.s* - store i64 0, i64* %a, align 8 - %a1 = bitcast i64* %a to i32* - store i32 1, i32* %a1, align 8 - call void @foo0(%struct.s* byval(%struct.s) %tmpcast) - store i32 2, i32* %a1, align 8 - call void @goo(%struct.s* byval(%struct.s) %tmpcast) - ret i32 0 -} diff --git a/llvm/test/Transforms/Inline/array_merge.ll b/llvm/test/Transforms/Inline/array_merge.ll deleted file mode 100644 --- a/llvm/test/Transforms/Inline/array_merge.ll +++ /dev/null @@ -1,26 +0,0 @@ -; RUN: opt < %s -inline -S -enable-new-pm=0 | FileCheck %s -; rdar://7173846 -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-darwin10.0" - -define internal void @foo() nounwind ssp { -entry: - %A = alloca [100 x i32] - %B = alloca [100 x i32] - call void @bar([100 x i32]* %A, [100 x i32]* %B) nounwind - ret void -} - -declare void @bar([100 x i32]*, [100 x i32]*) - -define void @test() nounwind ssp { -entry: -; CHECK: @test() -; CHECK-NEXT: entry: -; CHECK-NEXT: %A.i = alloca -; CHECK-NEXT: %B.i = alloca -; CHECK-NOT: alloca - call void @foo() nounwind - call void @foo() nounwind - ret void -} diff --git a/llvm/test/Transforms/Inline/dead-calls-willreturn.ll b/llvm/test/Transforms/Inline/dead-calls-willreturn.ll deleted file mode 100644 --- a/llvm/test/Transforms/Inline/dead-calls-willreturn.ll +++ /dev/null @@ -1,57 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -inline -S -enable-new-pm=0 %s | FileCheck %s - -; readnone but may not return according to attributes. -define void @readnone_may_not_return() nounwind readnone ssp { -; CHECK-LABEL: @readnone_may_not_return( -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[WHILE_BODY:%.*]] -; CHECK: while.body: -; CHECK-NEXT: br label [[WHILE_BODY]] -; -entry: - br label %while.body - -while.body: - br label %while.body -} - -; readnone and guaranteed to return according to attributes. -define void @readnone_willreturn() willreturn nounwind readnone ssp { -; CHECK-LABEL: @readnone_willreturn( -; CHECK-NEXT: entry: -; CHECK-NEXT: ret void -; -entry: - ret void -} - -; Make sure the call to @readnone is not treated as dead, because it is not -; marked as willreturn. -define void @caller_may_not_return() ssp { -; CHECK-LABEL: @caller_may_not_return( -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[WHILE_BODY_I:%.*]] -; CHECK: while.body.i: -; CHECK-NEXT: br label [[WHILE_BODY_I]] -; CHECK: readnone_may_not_return.exit: -; CHECK-NEXT: ret void -; -entry: - call void @readnone_may_not_return() - call void @readnone_willreturn() - ret void -} - -; @caller_willreturn is marked as willreturn, so all called functions also must -; return. All calls are dead. -define void @caller_willreturn() ssp { -; CHECK-LABEL: @caller_willreturn( -; CHECK-NEXT: entry: -; CHECK-NEXT: ret void -; -entry: - call void @readnone_may_not_return() willreturn - call void @readnone_willreturn() - ret void -} diff --git a/llvm/test/Transforms/Inline/delete-call.ll b/llvm/test/Transforms/Inline/delete-call.ll deleted file mode 100644 --- a/llvm/test/Transforms/Inline/delete-call.ll +++ /dev/null @@ -1,26 +0,0 @@ -; REQUIRES: asserts -; RUN: opt -S -inline -stats -enable-new-pm=0 < %s 2>&1 | FileCheck %s -; CHECK: Number of functions inlined - -; RUN: opt -S -inline -function-attrs -stats -enable-new-pm=0 < %s 2>&1 | FileCheck -check-prefix=CHECK-FUNCTIONATTRS %s -; CHECK-FUNCTIONATTRS: Number of call sites deleted, not inlined - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32" -target triple = "i386-apple-darwin9.8" - -define internal i32 @test(i32 %x, i32 %y, i32 %z) nounwind { -entry: - %0 = add nsw i32 %y, %z ; [#uses=1] - %1 = mul i32 %0, %x ; [#uses=1] - %2 = mul i32 %y, %z ; [#uses=1] - %3 = add nsw i32 %1, %2 ; [#uses=1] - ret i32 %3 -} - -define i32 @test2() nounwind { -entry: - %0 = call i32 @test(i32 1, i32 2, i32 4) nounwind ; [#uses=1] - ret i32 14 -} - - diff --git a/llvm/test/Transforms/Inline/externally_available.ll b/llvm/test/Transforms/Inline/externally_available.ll --- a/llvm/test/Transforms/Inline/externally_available.ll +++ b/llvm/test/Transforms/Inline/externally_available.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -inline -S -enable-new-pm=0 | FileCheck %s +; RUN: opt < %s -inline -S | FileCheck %s define available_externally i32 @test_function() { ; CHECK-NOT: @test_function diff --git a/llvm/test/Transforms/Inline/inline-cold-callee.ll b/llvm/test/Transforms/Inline/inline-cold-callee.ll deleted file mode 100644 --- a/llvm/test/Transforms/Inline/inline-cold-callee.ll +++ /dev/null @@ -1,46 +0,0 @@ -; RUN: opt < %s -inline -inlinecold-threshold=0 -S -enable-new-pm=0 | FileCheck %s - -; This tests that a cold callee gets the (lower) inlinecold-threshold even without -; Cold hint and does not get inlined because the cost exceeds the inlinecold-threshold. -; A callee with identical body does gets inlined because cost fits within the -; inline-threshold - -define i32 @callee1(i32 %x) !prof !21 { - %x1 = add i32 %x, 1 - ret i32 %x1 -} - -define i32 @callee2(i32 %x) !prof !22 { -; CHECK-LABEL: @callee2( - %x1 = add i32 %x, 1 - ret i32 %x1 -} - -define i32 @caller2(i32 %y1) !prof !22 { -; CHECK-LABEL: @caller2( -; CHECK: call i32 @callee2 -; CHECK-NOT: call i32 @callee1 -; CHECK: ret i32 %x1.i - %y2 = call i32 @callee2(i32 %y1) "function-inline-cost"="10" - %y3 = call i32 @callee1(i32 %y2) "function-inline-cost"="10" - ret i32 %y3 -} - -!llvm.module.flags = !{!1} -!21 = !{!"function_entry_count", i64 100} -!22 = !{!"function_entry_count", i64 1} - -!1 = !{i32 1, !"ProfileSummary", !2} -!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} -!3 = !{!"ProfileFormat", !"InstrProf"} -!4 = !{!"TotalCount", i64 10000} -!5 = !{!"MaxCount", i64 1000} -!6 = !{!"MaxInternalCount", i64 1} -!7 = !{!"MaxFunctionCount", i64 1000} -!8 = !{!"NumCounts", i64 3} -!9 = !{!"NumFunctions", i64 3} -!10 = !{!"DetailedSummary", !11} -!11 = !{!12, !13, !14} -!12 = !{i32 10000, i64 100, i32 1} -!13 = !{i32 999000, i64 100, i32 1} -!14 = !{i32 999999, i64 1, i32 2} diff --git a/llvm/test/Transforms/Inline/inline-cold.ll b/llvm/test/Transforms/Inline/inline-cold.ll --- a/llvm/test/Transforms/Inline/inline-cold.ll +++ b/llvm/test/Transforms/Inline/inline-cold.ll @@ -2,7 +2,7 @@ ; Test that functions with attribute Cold are not inlined while the ; same function without attribute Cold will be inlined. -; RUN: opt < %s -passes='require,cgscc(inline)' -S -inline-threshold=600 -enable-new-pm=0 | FileCheck %s -check-prefix=OVERRIDE +; RUN: opt < %s -passes='require,cgscc(inline)' -S -inline-threshold=600 | FileCheck %s -check-prefix=OVERRIDE ; The command line argument for inline-threshold should override ; the default cold threshold, so a cold function with size bigger ; than the default cold threshold (225) will be inlined. diff --git a/llvm/test/Transforms/Inline/inline-hot-callee.ll b/llvm/test/Transforms/Inline/inline-hot-callee.ll deleted file mode 100644 --- a/llvm/test/Transforms/Inline/inline-hot-callee.ll +++ /dev/null @@ -1,55 +0,0 @@ -; RUN: opt < %s -inline -inline-threshold=0 -inlinehint-threshold=100 -S -enable-new-pm=0 | FileCheck %s - -; This tests that a hot callee gets the (higher) inlinehint-threshold even -; without inline hints and gets inlined because the cost is less than -; inlinehint-threshold. A cold callee with identical body does not get inlined -; because cost exceeds the inline-threshold. This test is relevant only when the -; old pass manager is used. - -define i32 @callee1(i32 %x) !prof !21 { - %x1 = add i32 %x, 1 - %x2 = add i32 %x1, 1 - %x3 = add i32 %x2, 1 - call void @extern() - ret i32 %x3 -} - -define i32 @callee2(i32 %x) !prof !22 { -; CHECK-LABEL: @callee2( - %x1 = add i32 %x, 1 - %x2 = add i32 %x1, 1 - %x3 = add i32 %x2, 1 - call void @extern() - ret i32 %x3 -} - -define i32 @caller2(i32 %y1) !prof !22 { -; CHECK-LABEL: @caller2( -; CHECK: call i32 @callee2 -; CHECK-NOT: call i32 @callee1 -; CHECK: ret i32 %x3.i - %y2 = call i32 @callee2(i32 %y1) - %y3 = call i32 @callee1(i32 %y2) - ret i32 %y3 -} - -declare void @extern() - -!llvm.module.flags = !{!1} -!21 = !{!"function_entry_count", i64 300} -!22 = !{!"function_entry_count", i64 1} - -!1 = !{i32 1, !"ProfileSummary", !2} -!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} -!3 = !{!"ProfileFormat", !"InstrProf"} -!4 = !{!"TotalCount", i64 10000} -!5 = !{!"MaxCount", i64 1000} -!6 = !{!"MaxInternalCount", i64 1} -!7 = !{!"MaxFunctionCount", i64 1000} -!8 = !{!"NumCounts", i64 3} -!9 = !{!"NumFunctions", i64 3} -!10 = !{!"DetailedSummary", !11} -!11 = !{!12, !13, !14} -!12 = !{i32 10000, i64 100, i32 1} -!13 = !{i32 999000, i64 100, i32 1} -!14 = !{i32 999999, i64 1, i32 2} diff --git a/llvm/test/Transforms/Inline/null-function.ll b/llvm/test/Transforms/Inline/null-function.ll deleted file mode 100644 --- a/llvm/test/Transforms/Inline/null-function.ll +++ /dev/null @@ -1,9 +0,0 @@ -; RUN: opt -print-before=always-inline -always-inline -enable-new-pm=0 < %s -o /dev/null 2>&1 | FileCheck %s - -define i32 @main() #0 { -entry: - ret i32 0 -} - -; CHECK: *** IR Dump Before Inliner for always_inline functions (always-inline) *** -; CHECK: Printing Function