103 lines · plain
1; RUN: opt -passes=debugify -S -o - < %s | FileCheck %s2; RUN: opt -passes=debugify -S -o - < %s | FileCheck %s3 4; RUN: opt -passes=debugify,debugify -S -o - < %s 2>&1 | \5; RUN: FileCheck %s -check-prefix=CHECK-REPEAT6; RUN: opt -passes=debugify,debugify -S -o - < %s 2>&1 | \7; RUN: FileCheck %s -check-prefix=CHECK-REPEAT8 9; RUN: opt -passes=debugify,check-debugify -S -o - < %s | \10; RUN: FileCheck %s -implicit-check-not="CheckModuleDebugify: FAIL"11; RUN: opt -passes=debugify,check-debugify -S -o - < %s | \12; RUN: FileCheck %s -implicit-check-not="CheckModuleDebugify: FAIL"13; RUN: opt -enable-debugify -passes=verify -S -o - < %s | \14; RUN: FileCheck %s -implicit-check-not="CheckModuleDebugify: FAIL"15 16; RUN: opt -passes=debugify,strip,check-debugify -S -o - < %s 2>&1 | \17; RUN: FileCheck %s -check-prefix=CHECK-WARN18 19; RUN: opt -enable-debugify -passes=strip -S -o - < %s 2>&1 | \20; RUN: FileCheck %s -check-prefix=CHECK-WARN21 22; RUN: opt -enable-debugify -S -o - < %s 2>&1 | FileCheck %s -check-prefix=PASS23 24; Verify that debugify can be safely used with piping25; RUN: opt -enable-debugify -O1 < %s | opt -O2 -o /dev/null26; RUN: opt -passes=debugify,mem2reg,check-debugify < %s | opt -O2 -o /dev/null27 28; CHECK-LABEL: define void @foo29define void @foo() {30; CHECK: ret void, !dbg ![[RET1:.*]]31 ret void32}33 34; CHECK-LABEL: define i32 @bar35define i32 @bar() {36; CHECK: call void @foo(), !dbg ![[CALL1:.*]]37 call void @foo()38 39; CHECK: add i32 0, 1, !dbg ![[ADD1:.*]]40 %sum = add i32 0, 141 42; CHECK: ret i32 0, !dbg ![[RET2:.*]]43 ret i32 044}45 46; CHECK-LABEL: define weak_odr zeroext i1 @baz47define weak_odr zeroext i1 @baz() {48; CHECK-NOT: !dbg49 ret i1 false50}51 52; CHECK-LABEL: define i32 @boom53define i32 @boom() {54; CHECK: [[result:%.*]] = musttail call i32 @bar(), !dbg ![[musttail:.*]]55 %retval = musttail call i32 @bar()56; CHECK-NEXT: ret i32 [[result]], !dbg ![[musttailRes:.*]]57 ret i32 %retval58}59 60; CHECK-DAG: !llvm.dbg.cu = !{![[CU:.*]]}61; CHECK-DAG: !llvm.debugify = !{![[NUM_INSTS:.*]], ![[NUM_VARS:.*]]}62; CHECK-DAG: "Debug Info Version"63 64; CHECK-DAG: ![[CU]] = distinct !DICompileUnit(language: DW_LANG_C, file: {{.*}}, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)65; CHECK-DAG: !DIFile(filename: "<stdin>", directory: "/")66; CHECK-DAG: distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: {{.*}}, line: 1, type: {{.*}}, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: {{.*}}, retainedNodes: {{.*}})67; CHECK-DAG: distinct !DISubprogram(name: "bar", linkageName: "bar", scope: null, file: {{.*}}, line: 2, type: {{.*}}, scopeLine: 2, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: {{.*}}, retainedNodes: {{.*}})68 69; --- DILocations70; CHECK-DAG: ![[RET1]] = !DILocation(line: 1, column: 171; CHECK-DAG: ![[CALL1]] = !DILocation(line: 2, column: 172; CHECK-DAG: ![[ADD1]] = !DILocation(line: 3, column: 173; CHECK-DAG: ![[RET2]] = !DILocation(line: 4, column: 174; CHECK-DAG: ![[musttail]] = !DILocation(line: 5, column: 175; CHECK-DAG: ![[musttailRes]] = !DILocation(line: 6, column: 176 77; --- DILocalVariables78; CHECK-DAG: ![[TY32:.*]] = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)79; CHECK-DAG: !DILocalVariable(name: "1", scope: {{.*}}, file: {{.*}}, line: 1, type: ![[TY32]])80; CHECK-DAG: !DILocalVariable(name: "2", scope: {{.*}}, file: {{.*}}, line: 3, type: ![[TY32]])81; CHECK-DAG: !DILocalVariable(name: "3", scope: {{.*}}, file: {{.*}}, line: 5, type: ![[TY32]])82 83; --- Metadata counts84; CHECK-DAG: ![[NUM_INSTS]] = !{i32 6}85; CHECK-DAG: ![[NUM_VARS]] = !{i32 3}86 87; --- Repeat case88; CHECK-REPEAT: ModuleDebugify: Skipping module with debug info89 90; --- Failure case91; CHECK-WARN: WARNING: Instruction with empty DebugLoc in function foo -- ret void92; CHECK-WARN: WARNING: Instruction with empty DebugLoc in function bar -- call void @foo()93; CHECK-WARN: WARNING: Instruction with empty DebugLoc in function bar -- {{.*}} add i32 0, 194; CHECK-WARN: WARNING: Instruction with empty DebugLoc in function bar -- ret i32 095; CHECK-WARN: WARNING: Missing line 196; CHECK-WARN: WARNING: Missing line 297; CHECK-WARN: WARNING: Missing line 398; CHECK-WARN: WARNING: Missing line 499; CHECK-WARN: WARNING: Missing variable 1100; CHECK-WARN: CheckModuleDebugify: PASS101 102; PASS: CheckModuleDebugify: PASS103