1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 2; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s | FileCheck %s 3; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s --try-experimental-debuginfo-iterators | FileCheck %s 4 5target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" 6target triple = "thumbv7-none-linux-android19" 7 8define i32 @r() { 9; CHECK-LABEL: define i32 @r() { 10; CHECK-NEXT: entry: 11; CHECK-NEXT: [[DOTLOC:%.*]] = alloca ptr, align 4 12; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 -1, ptr [[DOTLOC]]) 13; CHECK-NEXT: [[TMP0:%.*]] = call i1 @outlined_ir_func_0(ptr [[DOTLOC]], i32 0) 14; CHECK-NEXT: [[DOTRELOAD:%.*]] = load ptr, ptr [[DOTLOC]], align 4 15; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 -1, ptr [[DOTLOC]]) 16; CHECK-NEXT: br i1 [[TMP0]], label [[IF_END8:%.*]], label [[ENTRY_AFTER_OUTLINE:%.*]] 17; CHECK: entry_after_outline: 18; CHECK-NEXT: [[CALL7:%.*]] = call i32 [[DOTRELOAD]]() 19; CHECK-NEXT: br label [[IF_END8]] 20; CHECK: if.end8: 21; CHECK-NEXT: ret i32 0 22; 23entry: 24 %.fca.2.insert = insertvalue [5 x i32] zeroinitializer, i32 0, 2 25 %.fca.3.load = load i32, ptr null, align 4 26 %.fca.3.insert = insertvalue [5 x i32] zeroinitializer, i32 0, 3 27 %.fca.4.load = load i32, ptr null, align 4 28 %.fca.4.insert = insertvalue [5 x i32] zeroinitializer, i32 0, 4 29 %call = call i32 @p() 30 %tobool.not = icmp eq i32 0, 0 31 br i1 false, label %if.end8, label %if.then 32 33if.then: ; preds = %entry 34 %0 = load i32, ptr null, align 4 35 %tobool1.not = icmp eq i32 0, 0 36 %1 = load i32, ptr null, align 4 37 %2 = load i32, ptr null, align 4 38 %cond = select i1 false, i32 0, i32 0 39 %tobool5.not = icmp eq i32 0, 0 40 br i1 false, label %if.end8, label %if.then6 41 42if.then6: ; preds = %if.then 43 %3 = load ptr, ptr null, align 4 44 %call7 = call i32 %3() 45 br label %if.end8 46 47if.end8: ; preds = %if.then6, %if.then, %entry 48 ret i32 0 49} 50 51declare i32 @p() 52 53define i32 @u() { 54; CHECK-LABEL: define i32 @u() { 55; CHECK-NEXT: entry: 56; CHECK-NEXT: [[TMP0:%.*]] = call i1 @outlined_ir_func_0(ptr null, i32 -1) 57; CHECK-NEXT: br i1 [[TMP0]], label [[IF_END8:%.*]], label [[ENTRY_AFTER_OUTLINE:%.*]] 58; CHECK: entry_after_outline: 59; CHECK-NEXT: br label [[IF_END8]] 60; CHECK: if.end8: 61; CHECK-NEXT: ret i32 0 62; 63entry: 64 %.fca.2.insert = insertvalue [5 x i32] zeroinitializer, i32 0, 2 65 %.fca.3.load = load i32, ptr null, align 4 66 %.fca.3.insert = insertvalue [5 x i32] zeroinitializer, i32 0, 3 67 %.fca.4.load = load i32, ptr null, align 4 68 %.fca.4.insert = insertvalue [5 x i32] zeroinitializer, i32 0, 4 69 %call = call i32 @p() 70 %tobool.not = icmp eq i32 0, 0 71 br i1 false, label %if.end8, label %if.then 72 73if.then: ; preds = %entry 74 %0 = load i32, ptr null, align 4 75 %tobool1.not = icmp eq i32 0, 0 76 %1 = load i32, ptr null, align 4 77 %2 = load i32, ptr null, align 4 78 %cond = select i1 false, i32 0, i32 0 79 %tobool5.not = icmp eq i32 0, 0 80 br i1 false, label %if.end8, label %if.then6 81 82if.then6: ; preds = %if.then 83 %3 = load ptr, ptr null, align 4 84 br label %if.end8 85 86if.end8: ; preds = %if.then6, %if.then, %entry 87 ret i32 0 88} 89 90define i32 @w() !dbg !8 { 91; CHECK-LABEL: define i32 @w( 92; CHECK-SAME: ) !dbg [[DBG8:![0-9]+]] { 93; CHECK-NEXT: entry: 94; CHECK-NEXT: [[RETVAL_1_CE_LOC:%.*]] = alloca i32, align 4 95; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 -1, ptr [[RETVAL_1_CE_LOC]]) 96; CHECK-NEXT: [[TMP0:%.*]] = call i1 @outlined_ir_func_0(ptr [[RETVAL_1_CE_LOC]], i32 1), !dbg [[DBG11:![0-9]+]] 97; CHECK-NEXT: [[RETVAL_1_CE_RELOAD:%.*]] = load i32, ptr [[RETVAL_1_CE_LOC]], align 4 98; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 -1, ptr [[RETVAL_1_CE_LOC]]) 99; CHECK-NEXT: br i1 [[TMP0]], label [[CLEANUP10:%.*]], label [[ENTRY_AFTER_OUTLINE:%.*]] 100; CHECK: entry_after_outline: 101; CHECK-NEXT: [[CALL8:%.*]] = call i32 @llvm.bswap.i32(i32 0) 102; CHECK-NEXT: br label [[CLEANUP10]] 103; CHECK: cleanup10: 104; CHECK-NEXT: [[RETVAL_1:%.*]] = phi i32 [ 0, [[ENTRY_AFTER_OUTLINE]] ], [ [[RETVAL_1_CE_RELOAD]], [[ENTRY:%.*]] ] 105; CHECK-NEXT: ret i32 0 106; 107entry: 108 %.fca.2.insert = insertvalue [5 x i32] zeroinitializer, i32 0, 2 109 %.fca.3.load = load i32, ptr null, align 4 110 %.fca.3.insert = insertvalue [5 x i32] zeroinitializer, i32 0, 3 111 %.fca.4.load = load i32, ptr null, align 4 112 %.fca.4.insert = insertvalue [5 x i32] zeroinitializer, i32 0, 4 113 %call = call i32 @p() 114 %tobool.not = icmp eq i32 0, 0 115 br i1 false, label %cleanup10, label %if.then 116 117if.then: ; preds = %entry 118 call void @llvm.dbg.value(metadata i32 0, metadata !11, metadata !DIExpression()), !dbg !15 119 %0 = load i32, ptr null, align 4 120 %tobool1.not = icmp eq i32 0, 0 121 %1 = load i32, ptr null, align 4 122 %2 = load i32, ptr null, align 4 123 %cond = select i1 false, i32 0, i32 0 124 %tobool5.not = icmp eq i32 0, 0 125 br i1 false, label %cleanup10, label %cleanup 126 127cleanup: ; preds = %if.then 128 %3 = load ptr, ptr null, align 4 129 %call8 = call i32 @llvm.bswap.i32(i32 0) 130 br label %cleanup10 131 132cleanup10: ; preds = %cleanup, %if.then, %entry 133 %retval.1 = phi i32 [ 0, %cleanup ], [ 0, %entry ], [ 0, %if.then ] 134 ret i32 0 135} 136 137; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 138declare void @llvm.dbg.value(metadata, metadata, metadata) #0 139 140; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 141declare i32 @llvm.bswap.i32(i32) #0 142 143attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 144 145!llvm.dbg.cu = !{!0} 146!llvm.module.flags = !{!7} 147 148!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 18.0.0 (https://github.com/llvm/llvm-project.git 2ca028ce7c6de5f1350440012355a65383b8729a)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !2, splitDebugInlining: false, nameTableKind: None) 149!1 = !DIFile(filename: "/tmp/foo.c", directory: "/home/davidino/llvm-build-upstream") 150!2 = !{!3} 151!3 = !DIGlobalVariableExpression(var: !4, expr: !DIExpression()) 152!4 = distinct !DIGlobalVariable(name: "n", scope: !0, file: !5, line: 19, type: !6, isLocal: false, isDefinition: true) 153!5 = !DIFile(filename: "/tmp/foo.c", directory: "") 154!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 155!7 = !{i32 2, !"Debug Info Version", i32 3} 156!8 = distinct !DISubprogram(name: "w", scope: !5, file: !5, line: 54, type: !9, scopeLine: 54, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10) 157!9 = !DISubroutineType(types: !10) 158!10 = !{} 159!11 = !DILocalVariable(name: "t", scope: !12, file: !5, line: 57, type: !14) 160!12 = distinct !DILexicalBlock(scope: !13, file: !5, line: 56, column: 17) 161!13 = distinct !DILexicalBlock(scope: !8, file: !5, line: 56, column: 11) 162!14 = !DIDerivedType(tag: DW_TAG_typedef, name: "a", file: !5, line: 2, baseType: !6) 163!15 = !DILocation(line: 0, scope: !12) 164;. 165; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None) 166; CHECK: [[META1]] = !DIFile(filename: "/tmp/foo.c", directory: {{.*}}) 167; CHECK: [[META2]] = !{[[META3:![0-9]+]]} 168; CHECK: [[META3]] = !DIGlobalVariableExpression(var: [[META4:![0-9]+]], expr: !DIExpression()) 169; CHECK: [[META4]] = distinct !DIGlobalVariable(name: "n", scope: [[META0]], file: [[META5:![0-9]+]], line: 19, type: [[META6:![0-9]+]], isLocal: false, isDefinition: true) 170; CHECK: [[META5]] = !DIFile(filename: "/tmp/foo.c", directory: "") 171; CHECK: [[META6]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 172; CHECK: [[DBG8]] = distinct !DISubprogram(name: "w", scope: [[META5]], file: [[META5]], line: 54, type: [[META9:![0-9]+]], scopeLine: 54, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META10:![0-9]+]]) 173; CHECK: [[META9]] = !DISubroutineType(types: [[META10]]) 174; CHECK: [[META10]] = !{} 175; CHECK: [[DBG11]] = !DILocation(line: 0, scope: [[DBG8]]) 176;. 177