https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/141814
>From 04f6229593a5891025d4ac240b3b5b15535a1e25 Mon Sep 17 00:00:00 2001 From: Thurston Dang <thurs...@google.com> Date: Wed, 28 May 2025 17:55:46 +0000 Subject: [PATCH 1/2] [NFCI][ubsan] Precommit tests for -fsanitize-annotate-debug-info These tests will track progress on extending https://github.com/llvm/llvm-project/pull/139809 from CFI to more UBSan checks. --- clang/test/CodeGen/ubsan-function-debuginfo.c | 74 +++++++++++++++ .../CodeGen/unsigned-promotion-debuginfo.c | 95 +++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 clang/test/CodeGen/ubsan-function-debuginfo.c create mode 100644 clang/test/CodeGen/unsigned-promotion-debuginfo.c diff --git a/clang/test/CodeGen/ubsan-function-debuginfo.c b/clang/test/CodeGen/ubsan-function-debuginfo.c new file mode 100644 index 0000000000000..c452b84907045 --- /dev/null +++ b/clang/test/CodeGen/ubsan-function-debuginfo.c @@ -0,0 +1,74 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -emit-llvm -triple x86_64 -std=c17 -fsanitize=function %s -o - \ +// RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \ +// RUN: -fsanitize-annotate-debug-info=function \ +// RUN: | FileCheck %s + +// CHECK-LABEL: define dso_local void @call_no_prototype( +// CHECK-SAME: ptr noundef [[F:%.*]]) #[[ATTR0:[0-9]+]] !dbg [[DBG4:![0-9]+]] !func_sanitize [[META12:![0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[F_ADDR:%.*]] = alloca ptr, align 8 +// CHECK-NEXT: store ptr [[F]], ptr [[F_ADDR]], align 8 +// CHECK-NEXT: #dbg_declare(ptr [[F_ADDR]], [[META13:![0-9]+]], !DIExpression(), [[META14:![0-9]+]]) +// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[F_ADDR]], align 8, !dbg [[DBG15:![0-9]+]] +// CHECK-NEXT: call void (...) [[TMP0]](), !dbg [[DBG15]] +// CHECK-NEXT: ret void, !dbg [[DBG16:![0-9]+]] +// +void call_no_prototype(void (*f)()) { f(); } + +// CHECK-LABEL: define dso_local void @call_prototype( +// CHECK-SAME: ptr noundef [[F:%.*]]) #[[ATTR0]] !dbg [[DBG17:![0-9]+]] !func_sanitize [[META23:![0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[F_ADDR:%.*]] = alloca ptr, align 8 +// CHECK-NEXT: store ptr [[F]], ptr [[F_ADDR]], align 8 +// CHECK-NEXT: #dbg_declare(ptr [[F_ADDR]], [[META24:![0-9]+]], !DIExpression(), [[META25:![0-9]+]]) +// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[F_ADDR]], align 8, !dbg [[DBG26:![0-9]+]] +// CHECK-NEXT: [[TMP1:%.*]] = getelementptr <{ i32, i32 }>, ptr [[TMP0]], i32 -1, i32 0, !dbg [[DBG26]], !nosanitize [[META11:![0-9]+]] +// CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4, !dbg [[DBG26]], !nosanitize [[META11]] +// CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP2]], -1056584962, !dbg [[DBG26]], !nosanitize [[META11]] +// CHECK-NEXT: br i1 [[TMP3]], label %[[TYPECHECK:.*]], label %[[CONT1:.*]], !dbg [[DBG26]], !nosanitize [[META11]] +// CHECK: [[TYPECHECK]]: +// CHECK-NEXT: [[TMP4:%.*]] = getelementptr <{ i32, i32 }>, ptr [[TMP0]], i32 -1, i32 1, !dbg [[DBG26]], !nosanitize [[META11]] +// CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP4]], align 8, !dbg [[DBG26]], !nosanitize [[META11]] +// CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 905068220, !dbg [[DBG26]], !nosanitize [[META11]] +// CHECK-NEXT: br i1 [[TMP6]], label %[[CONT:.*]], label %[[HANDLER_FUNCTION_TYPE_MISMATCH:.*]], !dbg [[DBG26]], !prof [[PROF27:![0-9]+]], !nosanitize [[META11]] +// CHECK: [[HANDLER_FUNCTION_TYPE_MISMATCH]]: +// CHECK-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP0]] to i64, !dbg [[DBG26]], !nosanitize [[META11]] +// CHECK-NEXT: call void @__ubsan_handle_function_type_mismatch_abort(ptr @[[GLOB1:[0-9]+]], i64 [[TMP7]]) #[[ATTR2:[0-9]+]], !dbg [[DBG26]], !nosanitize [[META11]] +// CHECK-NEXT: unreachable, !dbg [[DBG26]], !nosanitize [[META11]] +// CHECK: [[CONT]]: +// CHECK-NEXT: br label %[[CONT1]], !dbg [[DBG26]], !nosanitize [[META11]] +// CHECK: [[CONT1]]: +// CHECK-NEXT: call void [[TMP0]](), !dbg [[DBG26]] +// CHECK-NEXT: ret void, !dbg [[DBG28:![0-9]+]] +// +void call_prototype(void (*f)(void)) { f(); } +//. +// CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) +// CHECK: [[META1]] = !DIFile(filename: "<stdin>", directory: {{.*}}) +// CHECK: [[DBG4]] = distinct !DISubprogram(name: "call_no_prototype", scope: [[META5:![0-9]+]], file: [[META5]], line: 16, type: [[META6:![0-9]+]], scopeLine: 16, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META11]]) +// CHECK: [[META5]] = !DIFile(filename: "{{.*}}ubsan-function-debuginfo.c", directory: {{.*}}) +// CHECK: [[META6]] = !DISubroutineType(types: [[META7:![0-9]+]]) +// CHECK: [[META7]] = !{null, [[META8:![0-9]+]]} +// CHECK: [[META8]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META9:![0-9]+]], size: 64) +// CHECK: [[META9]] = !DISubroutineType(types: [[META10:![0-9]+]]) +// CHECK: [[META10]] = !{null, null} +// CHECK: [[META11]] = !{} +// CHECK: [[META12]] = !{i32 -1056584962, i32 187769638} +// CHECK: [[META13]] = !DILocalVariable(name: "f", arg: 1, scope: [[DBG4]], file: [[META5]], line: 16, type: [[META8]]) +// CHECK: [[META14]] = !DILocation(line: 16, column: 31, scope: [[DBG4]]) +// CHECK: [[DBG15]] = !DILocation(line: 16, column: 39, scope: [[DBG4]]) +// CHECK: [[DBG16]] = !DILocation(line: 16, column: 44, scope: [[DBG4]]) +// CHECK: [[DBG17]] = distinct !DISubprogram(name: "call_prototype", scope: [[META5]], file: [[META5]], line: 43, type: [[META18:![0-9]+]], scopeLine: 43, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META11]]) +// CHECK: [[META18]] = !DISubroutineType(types: [[META19:![0-9]+]]) +// CHECK: [[META19]] = !{null, [[META20:![0-9]+]]} +// CHECK: [[META20]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META21:![0-9]+]], size: 64) +// CHECK: [[META21]] = !DISubroutineType(types: [[META22:![0-9]+]]) +// CHECK: [[META22]] = !{null} +// CHECK: [[META23]] = !{i32 -1056584962, i32 -747727454} +// CHECK: [[META24]] = !DILocalVariable(name: "f", arg: 1, scope: [[DBG17]], file: [[META5]], line: 43, type: [[META20]]) +// CHECK: [[META25]] = !DILocation(line: 43, column: 28, scope: [[DBG17]]) +// CHECK: [[DBG26]] = !DILocation(line: 43, column: 40, scope: [[DBG17]]) +// CHECK: [[PROF27]] = !{!"branch_weights", i32 1048575, i32 1} +// CHECK: [[DBG28]] = !DILocation(line: 43, column: 45, scope: [[DBG17]]) +//. diff --git a/clang/test/CodeGen/unsigned-promotion-debuginfo.c b/clang/test/CodeGen/unsigned-promotion-debuginfo.c new file mode 100644 index 0000000000000..501096b002a0c --- /dev/null +++ b/clang/test/CodeGen/unsigned-promotion-debuginfo.c @@ -0,0 +1,95 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s \ +// RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \ +// RUN: -fsanitize-annotate-debug-info=signed-integer-overflow \ +// RUN: -fsanitize=signed-integer-overflow | FileCheck %s --check-prefix=CHECKS + +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s \ +// RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \ +// RUN: -fsanitize-annotate-debug-info=signed-integer-overflow \ +// RUN: -fsanitize=unsigned-integer-overflow | FileCheck %s --check-prefix=CHECKU + +unsigned short si, sj, sk; + +// CHECKS-LABEL: define dso_local void @testshortmul( +// CHECKS-SAME: ) #[[ATTR0:[0-9]+]] !dbg [[DBG13:![0-9]+]] { +// CHECKS-NEXT: [[ENTRY:.*:]] +// CHECKS-NEXT: [[TMP0:%.*]] = load i16, ptr @sj, align 2, !dbg [[DBG16:![0-9]+]] +// CHECKS-NEXT: [[CONV:%.*]] = zext i16 [[TMP0]] to i32, !dbg [[DBG16]] +// CHECKS-NEXT: [[TMP1:%.*]] = load i16, ptr @sk, align 2, !dbg [[DBG17:![0-9]+]] +// CHECKS-NEXT: [[CONV1:%.*]] = zext i16 [[TMP1]] to i32, !dbg [[DBG17]] +// CHECKS-NEXT: [[TMP2:%.*]] = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 [[CONV]], i32 [[CONV1]]), !dbg [[DBG18:![0-9]+]], !nosanitize [[META19:![0-9]+]] +// CHECKS-NEXT: [[TMP3:%.*]] = extractvalue { i32, i1 } [[TMP2]], 0, !dbg [[DBG18]], !nosanitize [[META19]] +// CHECKS-NEXT: [[TMP4:%.*]] = extractvalue { i32, i1 } [[TMP2]], 1, !dbg [[DBG18]], !nosanitize [[META19]] +// CHECKS-NEXT: [[TMP5:%.*]] = xor i1 [[TMP4]], true, !dbg [[DBG18]], !nosanitize [[META19]] +// CHECKS-NEXT: br i1 [[TMP5]], label %[[CONT:.*]], label %[[HANDLER_MUL_OVERFLOW:.*]], !dbg [[DBG18]], !prof [[PROF20:![0-9]+]], !nosanitize [[META19]] +// CHECKS: [[HANDLER_MUL_OVERFLOW]]: +// CHECKS-NEXT: [[TMP6:%.*]] = zext i32 [[CONV]] to i64, !dbg [[DBG18]], !nosanitize [[META19]] +// CHECKS-NEXT: [[TMP7:%.*]] = zext i32 [[CONV1]] to i64, !dbg [[DBG18]], !nosanitize [[META19]] +// CHECKS-NEXT: call void @__ubsan_handle_mul_overflow_abort(ptr @[[GLOB1:[0-9]+]], i64 [[TMP6]], i64 [[TMP7]]) #[[ATTR3:[0-9]+]], !dbg [[DBG18]], !nosanitize [[META19]] +// CHECKS-NEXT: unreachable, !dbg [[DBG18]], !nosanitize [[META19]] +// CHECKS: [[CONT]]: +// CHECKS-NEXT: [[CONV2:%.*]] = trunc i32 [[TMP3]] to i16, !dbg [[DBG16]] +// CHECKS-NEXT: store i16 [[CONV2]], ptr @si, align 2, !dbg [[DBG21:![0-9]+]] +// CHECKS-NEXT: ret void, !dbg [[DBG22:![0-9]+]] +// +// CHECKU-LABEL: define dso_local void @testshortmul( +// CHECKU-SAME: ) #[[ATTR0:[0-9]+]] !dbg [[DBG13:![0-9]+]] { +// CHECKU-NEXT: [[ENTRY:.*:]] +// CHECKU-NEXT: [[TMP0:%.*]] = load i16, ptr @sj, align 2, !dbg [[DBG16:![0-9]+]] +// CHECKU-NEXT: [[CONV:%.*]] = zext i16 [[TMP0]] to i32, !dbg [[DBG16]] +// CHECKU-NEXT: [[TMP1:%.*]] = load i16, ptr @sk, align 2, !dbg [[DBG17:![0-9]+]] +// CHECKU-NEXT: [[CONV1:%.*]] = zext i16 [[TMP1]] to i32, !dbg [[DBG17]] +// CHECKU-NEXT: [[MUL:%.*]] = mul nsw i32 [[CONV]], [[CONV1]], !dbg [[DBG18:![0-9]+]] +// CHECKU-NEXT: [[CONV2:%.*]] = trunc i32 [[MUL]] to i16, !dbg [[DBG16]] +// CHECKU-NEXT: store i16 [[CONV2]], ptr @si, align 2, !dbg [[DBG19:![0-9]+]] +// CHECKU-NEXT: ret void, !dbg [[DBG20:![0-9]+]] +// +void testshortmul(void) { + + // + si = sj * sk; +} +//. +// CHECKS: [[META0:![0-9]+]] = !DIGlobalVariableExpression(var: [[META1:![0-9]+]], expr: !DIExpression()) +// CHECKS: [[META1]] = distinct !DIGlobalVariable(name: "sj", scope: [[META2:![0-9]+]], file: [[META7:![0-9]+]], line: 12, type: [[META8:![0-9]+]], isLocal: false, isDefinition: true) +// CHECKS: [[META2]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META3:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: [[META4:![0-9]+]], splitDebugInlining: false, nameTableKind: None) +// CHECKS: [[META3]] = !DIFile(filename: "<stdin>", directory: {{.*}}) +// CHECKS: [[META4]] = !{[[META5:![0-9]+]], [[META0]], [[META9:![0-9]+]]} +// CHECKS: [[META5]] = !DIGlobalVariableExpression(var: [[META6:![0-9]+]], expr: !DIExpression()) +// CHECKS: [[META6]] = distinct !DIGlobalVariable(name: "si", scope: [[META2]], file: [[META7]], line: 12, type: [[META8]], isLocal: false, isDefinition: true) +// CHECKS: [[META7]] = !DIFile(filename: "{{.*}}unsigned-promotion-debuginfo.c", directory: {{.*}}) +// CHECKS: [[META8]] = !DIBasicType(name: "unsigned short", size: 16, encoding: DW_ATE_unsigned) +// CHECKS: [[META9]] = !DIGlobalVariableExpression(var: [[META10:![0-9]+]], expr: !DIExpression()) +// CHECKS: [[META10]] = distinct !DIGlobalVariable(name: "sk", scope: [[META2]], file: [[META7]], line: 12, type: [[META8]], isLocal: false, isDefinition: true) +// CHECKS: [[DBG13]] = distinct !DISubprogram(name: "testshortmul", scope: [[META7]], file: [[META7]], line: 48, type: [[META14:![0-9]+]], scopeLine: 48, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META2]]) +// CHECKS: [[META14]] = !DISubroutineType(types: [[META15:![0-9]+]]) +// CHECKS: [[META15]] = !{null} +// CHECKS: [[DBG16]] = !DILocation(line: 51, column: 8, scope: [[DBG13]]) +// CHECKS: [[DBG17]] = !DILocation(line: 51, column: 13, scope: [[DBG13]]) +// CHECKS: [[DBG18]] = !DILocation(line: 51, column: 11, scope: [[DBG13]]) +// CHECKS: [[META19]] = !{} +// CHECKS: [[PROF20]] = !{!"branch_weights", i32 1048575, i32 1} +// CHECKS: [[DBG21]] = !DILocation(line: 51, column: 6, scope: [[DBG13]]) +// CHECKS: [[DBG22]] = !DILocation(line: 52, column: 1, scope: [[DBG13]]) +//. +// CHECKU: [[META0:![0-9]+]] = !DIGlobalVariableExpression(var: [[META1:![0-9]+]], expr: !DIExpression()) +// CHECKU: [[META1]] = distinct !DIGlobalVariable(name: "sj", scope: [[META2:![0-9]+]], file: [[META7:![0-9]+]], line: 12, type: [[META8:![0-9]+]], isLocal: false, isDefinition: true) +// CHECKU: [[META2]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META3:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: [[META4:![0-9]+]], splitDebugInlining: false, nameTableKind: None) +// CHECKU: [[META3]] = !DIFile(filename: "<stdin>", directory: {{.*}}) +// CHECKU: [[META4]] = !{[[META5:![0-9]+]], [[META0]], [[META9:![0-9]+]]} +// CHECKU: [[META5]] = !DIGlobalVariableExpression(var: [[META6:![0-9]+]], expr: !DIExpression()) +// CHECKU: [[META6]] = distinct !DIGlobalVariable(name: "si", scope: [[META2]], file: [[META7]], line: 12, type: [[META8]], isLocal: false, isDefinition: true) +// CHECKU: [[META7]] = !DIFile(filename: "{{.*}}unsigned-promotion-debuginfo.c", directory: {{.*}}) +// CHECKU: [[META8]] = !DIBasicType(name: "unsigned short", size: 16, encoding: DW_ATE_unsigned) +// CHECKU: [[META9]] = !DIGlobalVariableExpression(var: [[META10:![0-9]+]], expr: !DIExpression()) +// CHECKU: [[META10]] = distinct !DIGlobalVariable(name: "sk", scope: [[META2]], file: [[META7]], line: 12, type: [[META8]], isLocal: false, isDefinition: true) +// CHECKU: [[DBG13]] = distinct !DISubprogram(name: "testshortmul", scope: [[META7]], file: [[META7]], line: 48, type: [[META14:![0-9]+]], scopeLine: 48, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META2]]) +// CHECKU: [[META14]] = !DISubroutineType(types: [[META15:![0-9]+]]) +// CHECKU: [[META15]] = !{null} +// CHECKU: [[DBG16]] = !DILocation(line: 51, column: 8, scope: [[DBG13]]) +// CHECKU: [[DBG17]] = !DILocation(line: 51, column: 13, scope: [[DBG13]]) +// CHECKU: [[DBG18]] = !DILocation(line: 51, column: 11, scope: [[DBG13]]) +// CHECKU: [[DBG19]] = !DILocation(line: 51, column: 6, scope: [[DBG13]]) +// CHECKU: [[DBG20]] = !DILocation(line: 52, column: 1, scope: [[DBG13]]) +//. >From 00ad108efa987088811e5ea9e443d009c4ea17a7 Mon Sep 17 00:00:00 2001 From: Thurston Dang <thurs...@google.com> Date: Wed, 28 May 2025 18:04:18 +0000 Subject: [PATCH 2/2] Use -O2 --- clang/test/CodeGen/ubsan-function-debuginfo.c | 104 +++++++++--------- .../CodeGen/unsigned-promotion-debuginfo.c | 90 +++++++-------- 2 files changed, 96 insertions(+), 98 deletions(-) diff --git a/clang/test/CodeGen/ubsan-function-debuginfo.c b/clang/test/CodeGen/ubsan-function-debuginfo.c index c452b84907045..960f3357cb239 100644 --- a/clang/test/CodeGen/ubsan-function-debuginfo.c +++ b/clang/test/CodeGen/ubsan-function-debuginfo.c @@ -1,74 +1,68 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 -// RUN: %clang_cc1 -emit-llvm -triple x86_64 -std=c17 -fsanitize=function %s -o - \ +// RUN: %clang_cc1 -O2 -emit-llvm -triple x86_64 -std=c17 -fsanitize=function %s -o - \ // RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \ // RUN: -fsanitize-annotate-debug-info=function \ // RUN: | FileCheck %s // CHECK-LABEL: define dso_local void @call_no_prototype( -// CHECK-SAME: ptr noundef [[F:%.*]]) #[[ATTR0:[0-9]+]] !dbg [[DBG4:![0-9]+]] !func_sanitize [[META12:![0-9]+]] { +// CHECK-SAME: ptr noundef readonly captures(none) [[F:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] !dbg [[DBG5:![0-9]+]] !func_sanitize [[META14:![0-9]+]] { // CHECK-NEXT: [[ENTRY:.*:]] -// CHECK-NEXT: [[F_ADDR:%.*]] = alloca ptr, align 8 -// CHECK-NEXT: store ptr [[F]], ptr [[F_ADDR]], align 8 -// CHECK-NEXT: #dbg_declare(ptr [[F_ADDR]], [[META13:![0-9]+]], !DIExpression(), [[META14:![0-9]+]]) -// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[F_ADDR]], align 8, !dbg [[DBG15:![0-9]+]] -// CHECK-NEXT: call void (...) [[TMP0]](), !dbg [[DBG15]] -// CHECK-NEXT: ret void, !dbg [[DBG16:![0-9]+]] +// CHECK-NEXT: #dbg_value(ptr [[F]], [[META13:![0-9]+]], !DIExpression(), [[META15:![0-9]+]]) +// CHECK-NEXT: tail call void (...) [[F]]() #[[ATTR2:[0-9]+]], !dbg [[DBG16:![0-9]+]] +// CHECK-NEXT: ret void, !dbg [[DBG17:![0-9]+]] // void call_no_prototype(void (*f)()) { f(); } // CHECK-LABEL: define dso_local void @call_prototype( -// CHECK-SAME: ptr noundef [[F:%.*]]) #[[ATTR0]] !dbg [[DBG17:![0-9]+]] !func_sanitize [[META23:![0-9]+]] { +// CHECK-SAME: ptr noundef [[F:%.*]]) local_unnamed_addr #[[ATTR0]] !dbg [[DBG18:![0-9]+]] !func_sanitize [[META26:![0-9]+]] { // CHECK-NEXT: [[ENTRY:.*:]] -// CHECK-NEXT: [[F_ADDR:%.*]] = alloca ptr, align 8 -// CHECK-NEXT: store ptr [[F]], ptr [[F_ADDR]], align 8 -// CHECK-NEXT: #dbg_declare(ptr [[F_ADDR]], [[META24:![0-9]+]], !DIExpression(), [[META25:![0-9]+]]) -// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[F_ADDR]], align 8, !dbg [[DBG26:![0-9]+]] -// CHECK-NEXT: [[TMP1:%.*]] = getelementptr <{ i32, i32 }>, ptr [[TMP0]], i32 -1, i32 0, !dbg [[DBG26]], !nosanitize [[META11:![0-9]+]] -// CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4, !dbg [[DBG26]], !nosanitize [[META11]] -// CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP2]], -1056584962, !dbg [[DBG26]], !nosanitize [[META11]] -// CHECK-NEXT: br i1 [[TMP3]], label %[[TYPECHECK:.*]], label %[[CONT1:.*]], !dbg [[DBG26]], !nosanitize [[META11]] +// CHECK-NEXT: #dbg_value(ptr [[F]], [[META25:![0-9]+]], !DIExpression(), [[META27:![0-9]+]]) +// CHECK-NEXT: [[TMP0:%.*]] = getelementptr i8, ptr [[F]], i64 -8, !dbg [[DBG28:![0-9]+]] +// CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4, !dbg [[DBG28]], !nosanitize [[META29:![0-9]+]] +// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], -1056584962, !dbg [[DBG28]], !nosanitize [[META29]] +// CHECK-NEXT: br i1 [[TMP2]], label %[[TYPECHECK:.*]], label %[[CONT1:.*]], !dbg [[DBG28]], !nosanitize [[META29]] // CHECK: [[TYPECHECK]]: -// CHECK-NEXT: [[TMP4:%.*]] = getelementptr <{ i32, i32 }>, ptr [[TMP0]], i32 -1, i32 1, !dbg [[DBG26]], !nosanitize [[META11]] -// CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP4]], align 8, !dbg [[DBG26]], !nosanitize [[META11]] -// CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 905068220, !dbg [[DBG26]], !nosanitize [[META11]] -// CHECK-NEXT: br i1 [[TMP6]], label %[[CONT:.*]], label %[[HANDLER_FUNCTION_TYPE_MISMATCH:.*]], !dbg [[DBG26]], !prof [[PROF27:![0-9]+]], !nosanitize [[META11]] +// CHECK-NEXT: [[TMP3:%.*]] = getelementptr i8, ptr [[F]], i64 -4, !dbg [[DBG28]] +// CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 8, !dbg [[DBG28]], !nosanitize [[META29]] +// CHECK-NEXT: [[TMP5:%.*]] = icmp eq i32 [[TMP4]], 905068220, !dbg [[DBG28]], !nosanitize [[META29]] +// CHECK-NEXT: br i1 [[TMP5]], label %[[CONT1]], label %[[HANDLER_FUNCTION_TYPE_MISMATCH:.*]], !dbg [[DBG28]], !prof [[PROF30:![0-9]+]], !nosanitize [[META29]] // CHECK: [[HANDLER_FUNCTION_TYPE_MISMATCH]]: -// CHECK-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP0]] to i64, !dbg [[DBG26]], !nosanitize [[META11]] -// CHECK-NEXT: call void @__ubsan_handle_function_type_mismatch_abort(ptr @[[GLOB1:[0-9]+]], i64 [[TMP7]]) #[[ATTR2:[0-9]+]], !dbg [[DBG26]], !nosanitize [[META11]] -// CHECK-NEXT: unreachable, !dbg [[DBG26]], !nosanitize [[META11]] -// CHECK: [[CONT]]: -// CHECK-NEXT: br label %[[CONT1]], !dbg [[DBG26]], !nosanitize [[META11]] +// CHECK-NEXT: [[TMP6:%.*]] = ptrtoint ptr [[F]] to i64, !dbg [[DBG28]], !nosanitize [[META29]] +// CHECK-NEXT: tail call void @__ubsan_handle_function_type_mismatch_abort(ptr nonnull @[[GLOB1:[0-9]+]], i64 [[TMP6]]) #[[ATTR3:[0-9]+]], !dbg [[DBG28]], !nosanitize [[META29]] +// CHECK-NEXT: unreachable, !dbg [[DBG28]], !nosanitize [[META29]] // CHECK: [[CONT1]]: -// CHECK-NEXT: call void [[TMP0]](), !dbg [[DBG26]] -// CHECK-NEXT: ret void, !dbg [[DBG28:![0-9]+]] +// CHECK-NEXT: tail call void [[F]]() #[[ATTR2]], !dbg [[DBG28]] +// CHECK-NEXT: ret void, !dbg [[DBG31:![0-9]+]] // void call_prototype(void (*f)(void)) { f(); } //. -// CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) -// CHECK: [[META1]] = !DIFile(filename: "<stdin>", directory: {{.*}}) -// CHECK: [[DBG4]] = distinct !DISubprogram(name: "call_no_prototype", scope: [[META5:![0-9]+]], file: [[META5]], line: 16, type: [[META6:![0-9]+]], scopeLine: 16, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META11]]) -// CHECK: [[META5]] = !DIFile(filename: "{{.*}}ubsan-function-debuginfo.c", directory: {{.*}}) -// CHECK: [[META6]] = !DISubroutineType(types: [[META7:![0-9]+]]) -// CHECK: [[META7]] = !{null, [[META8:![0-9]+]]} -// CHECK: [[META8]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META9:![0-9]+]], size: 64) -// CHECK: [[META9]] = !DISubroutineType(types: [[META10:![0-9]+]]) -// CHECK: [[META10]] = !{null, null} -// CHECK: [[META11]] = !{} -// CHECK: [[META12]] = !{i32 -1056584962, i32 187769638} -// CHECK: [[META13]] = !DILocalVariable(name: "f", arg: 1, scope: [[DBG4]], file: [[META5]], line: 16, type: [[META8]]) -// CHECK: [[META14]] = !DILocation(line: 16, column: 31, scope: [[DBG4]]) -// CHECK: [[DBG15]] = !DILocation(line: 16, column: 39, scope: [[DBG4]]) -// CHECK: [[DBG16]] = !DILocation(line: 16, column: 44, scope: [[DBG4]]) -// CHECK: [[DBG17]] = distinct !DISubprogram(name: "call_prototype", scope: [[META5]], file: [[META5]], line: 43, type: [[META18:![0-9]+]], scopeLine: 43, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META11]]) -// CHECK: [[META18]] = !DISubroutineType(types: [[META19:![0-9]+]]) -// CHECK: [[META19]] = !{null, [[META20:![0-9]+]]} -// CHECK: [[META20]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META21:![0-9]+]], size: 64) -// CHECK: [[META21]] = !DISubroutineType(types: [[META22:![0-9]+]]) -// CHECK: [[META22]] = !{null} -// CHECK: [[META23]] = !{i32 -1056584962, i32 -747727454} -// CHECK: [[META24]] = !DILocalVariable(name: "f", arg: 1, scope: [[DBG17]], file: [[META5]], line: 43, type: [[META20]]) -// CHECK: [[META25]] = !DILocation(line: 43, column: 28, scope: [[DBG17]]) -// CHECK: [[DBG26]] = !DILocation(line: 43, column: 40, scope: [[DBG17]]) -// CHECK: [[PROF27]] = !{!"branch_weights", i32 1048575, i32 1} -// CHECK: [[DBG28]] = !DILocation(line: 43, column: 45, scope: [[DBG17]]) +// CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) +// CHECK: [[META1]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}}) +// CHECK: [[DBG5]] = distinct !DISubprogram(name: "call_no_prototype", scope: [[META6:![0-9]+]], file: [[META6]], line: 17, type: [[META7:![0-9]+]], scopeLine: 17, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META12:![0-9]+]]) +// CHECK: [[META6]] = !DIFile(filename: "{{.*}}ubsan-function-debuginfo.c", directory: {{.*}}) +// CHECK: [[META7]] = !DISubroutineType(types: [[META8:![0-9]+]]) +// CHECK: [[META8]] = !{null, [[META9:![0-9]+]]} +// CHECK: [[META9]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META10:![0-9]+]], size: 64) +// CHECK: [[META10]] = !DISubroutineType(types: [[META11:![0-9]+]]) +// CHECK: [[META11]] = !{null, null} +// CHECK: [[META12]] = !{[[META13]]} +// CHECK: [[META13]] = !DILocalVariable(name: "f", arg: 1, scope: [[DBG5]], file: [[META6]], line: 17, type: [[META9]]) +// CHECK: [[META14]] = !{i32 -1056584962, i32 187769638} +// CHECK: [[META15]] = !DILocation(line: 0, scope: [[DBG5]]) +// CHECK: [[DBG16]] = !DILocation(line: 17, column: 39, scope: [[DBG5]]) +// CHECK: [[DBG17]] = !DILocation(line: 17, column: 44, scope: [[DBG5]]) +// CHECK: [[DBG18]] = distinct !DISubprogram(name: "call_prototype", scope: [[META6]], file: [[META6]], line: 45, type: [[META19:![0-9]+]], scopeLine: 45, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META24:![0-9]+]]) +// CHECK: [[META19]] = !DISubroutineType(types: [[META20:![0-9]+]]) +// CHECK: [[META20]] = !{null, [[META21:![0-9]+]]} +// CHECK: [[META21]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META22:![0-9]+]], size: 64) +// CHECK: [[META22]] = !DISubroutineType(types: [[META23:![0-9]+]]) +// CHECK: [[META23]] = !{null} +// CHECK: [[META24]] = !{[[META25]]} +// CHECK: [[META25]] = !DILocalVariable(name: "f", arg: 1, scope: [[DBG18]], file: [[META6]], line: 45, type: [[META21]]) +// CHECK: [[META26]] = !{i32 -1056584962, i32 -747727454} +// CHECK: [[META27]] = !DILocation(line: 0, scope: [[DBG18]]) +// CHECK: [[DBG28]] = !DILocation(line: 45, column: 40, scope: [[DBG18]]) +// CHECK: [[META29]] = !{} +// CHECK: [[PROF30]] = !{!"branch_weights", i32 1048575, i32 1} +// CHECK: [[DBG31]] = !DILocation(line: 45, column: 45, scope: [[DBG18]]) //. diff --git a/clang/test/CodeGen/unsigned-promotion-debuginfo.c b/clang/test/CodeGen/unsigned-promotion-debuginfo.c index 501096b002a0c..1472bf993ce41 100644 --- a/clang/test/CodeGen/unsigned-promotion-debuginfo.c +++ b/clang/test/CodeGen/unsigned-promotion-debuginfo.c @@ -1,10 +1,10 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s \ +// RUN: %clang_cc1 -O2 -triple x86_64-linux-gnu -emit-llvm -o - %s \ // RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \ // RUN: -fsanitize-annotate-debug-info=signed-integer-overflow \ // RUN: -fsanitize=signed-integer-overflow | FileCheck %s --check-prefix=CHECKS -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s \ +// RUN: %clang_cc1 -O2 -triple x86_64-linux-gnu -emit-llvm -o - %s \ // RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \ // RUN: -fsanitize-annotate-debug-info=signed-integer-overflow \ // RUN: -fsanitize=unsigned-integer-overflow | FileCheck %s --check-prefix=CHECKU @@ -12,38 +12,34 @@ unsigned short si, sj, sk; // CHECKS-LABEL: define dso_local void @testshortmul( -// CHECKS-SAME: ) #[[ATTR0:[0-9]+]] !dbg [[DBG13:![0-9]+]] { +// CHECKS-SAME: ) local_unnamed_addr #[[ATTR0:[0-9]+]] !dbg [[DBG13:![0-9]+]] { // CHECKS-NEXT: [[ENTRY:.*:]] -// CHECKS-NEXT: [[TMP0:%.*]] = load i16, ptr @sj, align 2, !dbg [[DBG16:![0-9]+]] +// CHECKS-NEXT: [[TMP0:%.*]] = load i16, ptr @sj, align 2, !dbg [[DBG16:![0-9]+]], !tbaa [[TBAA17:![0-9]+]] // CHECKS-NEXT: [[CONV:%.*]] = zext i16 [[TMP0]] to i32, !dbg [[DBG16]] -// CHECKS-NEXT: [[TMP1:%.*]] = load i16, ptr @sk, align 2, !dbg [[DBG17:![0-9]+]] -// CHECKS-NEXT: [[CONV1:%.*]] = zext i16 [[TMP1]] to i32, !dbg [[DBG17]] -// CHECKS-NEXT: [[TMP2:%.*]] = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 [[CONV]], i32 [[CONV1]]), !dbg [[DBG18:![0-9]+]], !nosanitize [[META19:![0-9]+]] -// CHECKS-NEXT: [[TMP3:%.*]] = extractvalue { i32, i1 } [[TMP2]], 0, !dbg [[DBG18]], !nosanitize [[META19]] -// CHECKS-NEXT: [[TMP4:%.*]] = extractvalue { i32, i1 } [[TMP2]], 1, !dbg [[DBG18]], !nosanitize [[META19]] -// CHECKS-NEXT: [[TMP5:%.*]] = xor i1 [[TMP4]], true, !dbg [[DBG18]], !nosanitize [[META19]] -// CHECKS-NEXT: br i1 [[TMP5]], label %[[CONT:.*]], label %[[HANDLER_MUL_OVERFLOW:.*]], !dbg [[DBG18]], !prof [[PROF20:![0-9]+]], !nosanitize [[META19]] +// CHECKS-NEXT: [[TMP1:%.*]] = load i16, ptr @sk, align 2, !dbg [[DBG21:![0-9]+]], !tbaa [[TBAA17]] +// CHECKS-NEXT: [[CONV1:%.*]] = zext i16 [[TMP1]] to i32, !dbg [[DBG21]] +// CHECKS-NEXT: [[TMP2:%.*]] = tail call { i32, i1 } @llvm.smul.with.overflow.i32(i32 [[CONV]], i32 [[CONV1]]), !dbg [[DBG22:![0-9]+]], !nosanitize [[META23:![0-9]+]] +// CHECKS-NEXT: [[TMP3:%.*]] = extractvalue { i32, i1 } [[TMP2]], 1, !dbg [[DBG22]], !nosanitize [[META23]] +// CHECKS-NEXT: br i1 [[TMP3]], label %[[HANDLER_MUL_OVERFLOW:.*]], label %[[CONT:.*]], !dbg [[DBG22]], !prof [[PROF24:![0-9]+]], !nosanitize [[META23]] // CHECKS: [[HANDLER_MUL_OVERFLOW]]: -// CHECKS-NEXT: [[TMP6:%.*]] = zext i32 [[CONV]] to i64, !dbg [[DBG18]], !nosanitize [[META19]] -// CHECKS-NEXT: [[TMP7:%.*]] = zext i32 [[CONV1]] to i64, !dbg [[DBG18]], !nosanitize [[META19]] -// CHECKS-NEXT: call void @__ubsan_handle_mul_overflow_abort(ptr @[[GLOB1:[0-9]+]], i64 [[TMP6]], i64 [[TMP7]]) #[[ATTR3:[0-9]+]], !dbg [[DBG18]], !nosanitize [[META19]] -// CHECKS-NEXT: unreachable, !dbg [[DBG18]], !nosanitize [[META19]] +// CHECKS-NEXT: [[TMP4:%.*]] = zext i16 [[TMP0]] to i64, !dbg [[DBG22]] +// CHECKS-NEXT: [[TMP5:%.*]] = zext i16 [[TMP1]] to i64, !dbg [[DBG22]] +// CHECKS-NEXT: tail call void @__ubsan_handle_mul_overflow_abort(ptr nonnull @[[GLOB1:[0-9]+]], i64 [[TMP4]], i64 [[TMP5]]) #[[ATTR3:[0-9]+]], !dbg [[DBG22]], !nosanitize [[META23]] +// CHECKS-NEXT: unreachable, !dbg [[DBG22]], !nosanitize [[META23]] // CHECKS: [[CONT]]: -// CHECKS-NEXT: [[CONV2:%.*]] = trunc i32 [[TMP3]] to i16, !dbg [[DBG16]] -// CHECKS-NEXT: store i16 [[CONV2]], ptr @si, align 2, !dbg [[DBG21:![0-9]+]] -// CHECKS-NEXT: ret void, !dbg [[DBG22:![0-9]+]] +// CHECKS-NEXT: [[TMP6:%.*]] = extractvalue { i32, i1 } [[TMP2]], 0, !dbg [[DBG22]], !nosanitize [[META23]] +// CHECKS-NEXT: [[CONV2:%.*]] = trunc i32 [[TMP6]] to i16, !dbg [[DBG16]] +// CHECKS-NEXT: store i16 [[CONV2]], ptr @si, align 2, !dbg [[DBG25:![0-9]+]], !tbaa [[TBAA17]] +// CHECKS-NEXT: ret void, !dbg [[DBG26:![0-9]+]] // // CHECKU-LABEL: define dso_local void @testshortmul( -// CHECKU-SAME: ) #[[ATTR0:[0-9]+]] !dbg [[DBG13:![0-9]+]] { +// CHECKU-SAME: ) local_unnamed_addr #[[ATTR0:[0-9]+]] !dbg [[DBG13:![0-9]+]] { // CHECKU-NEXT: [[ENTRY:.*:]] -// CHECKU-NEXT: [[TMP0:%.*]] = load i16, ptr @sj, align 2, !dbg [[DBG16:![0-9]+]] -// CHECKU-NEXT: [[CONV:%.*]] = zext i16 [[TMP0]] to i32, !dbg [[DBG16]] -// CHECKU-NEXT: [[TMP1:%.*]] = load i16, ptr @sk, align 2, !dbg [[DBG17:![0-9]+]] -// CHECKU-NEXT: [[CONV1:%.*]] = zext i16 [[TMP1]] to i32, !dbg [[DBG17]] -// CHECKU-NEXT: [[MUL:%.*]] = mul nsw i32 [[CONV]], [[CONV1]], !dbg [[DBG18:![0-9]+]] -// CHECKU-NEXT: [[CONV2:%.*]] = trunc i32 [[MUL]] to i16, !dbg [[DBG16]] -// CHECKU-NEXT: store i16 [[CONV2]], ptr @si, align 2, !dbg [[DBG19:![0-9]+]] -// CHECKU-NEXT: ret void, !dbg [[DBG20:![0-9]+]] +// CHECKU-NEXT: [[TMP0:%.*]] = load i16, ptr @sj, align 2, !dbg [[DBG16:![0-9]+]], !tbaa [[TBAA17:![0-9]+]] +// CHECKU-NEXT: [[TMP1:%.*]] = load i16, ptr @sk, align 2, !dbg [[DBG21:![0-9]+]], !tbaa [[TBAA17]] +// CHECKU-NEXT: [[MUL:%.*]] = mul i16 [[TMP1]], [[TMP0]], !dbg [[DBG22:![0-9]+]] +// CHECKU-NEXT: store i16 [[MUL]], ptr @si, align 2, !dbg [[DBG23:![0-9]+]], !tbaa [[TBAA17]] +// CHECKU-NEXT: ret void, !dbg [[DBG24:![0-9]+]] // void testshortmul(void) { @@ -53,8 +49,8 @@ void testshortmul(void) { //. // CHECKS: [[META0:![0-9]+]] = !DIGlobalVariableExpression(var: [[META1:![0-9]+]], expr: !DIExpression()) // CHECKS: [[META1]] = distinct !DIGlobalVariable(name: "sj", scope: [[META2:![0-9]+]], file: [[META7:![0-9]+]], line: 12, type: [[META8:![0-9]+]], isLocal: false, isDefinition: true) -// CHECKS: [[META2]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META3:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: [[META4:![0-9]+]], splitDebugInlining: false, nameTableKind: None) -// CHECKS: [[META3]] = !DIFile(filename: "<stdin>", directory: {{.*}}) +// CHECKS: [[META2]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META3:![0-9]+]], isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: [[META4:![0-9]+]], splitDebugInlining: false, nameTableKind: None) +// CHECKS: [[META3]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}}) // CHECKS: [[META4]] = !{[[META5:![0-9]+]], [[META0]], [[META9:![0-9]+]]} // CHECKS: [[META5]] = !DIGlobalVariableExpression(var: [[META6:![0-9]+]], expr: !DIExpression()) // CHECKS: [[META6]] = distinct !DIGlobalVariable(name: "si", scope: [[META2]], file: [[META7]], line: 12, type: [[META8]], isLocal: false, isDefinition: true) @@ -62,21 +58,25 @@ void testshortmul(void) { // CHECKS: [[META8]] = !DIBasicType(name: "unsigned short", size: 16, encoding: DW_ATE_unsigned) // CHECKS: [[META9]] = !DIGlobalVariableExpression(var: [[META10:![0-9]+]], expr: !DIExpression()) // CHECKS: [[META10]] = distinct !DIGlobalVariable(name: "sk", scope: [[META2]], file: [[META7]], line: 12, type: [[META8]], isLocal: false, isDefinition: true) -// CHECKS: [[DBG13]] = distinct !DISubprogram(name: "testshortmul", scope: [[META7]], file: [[META7]], line: 48, type: [[META14:![0-9]+]], scopeLine: 48, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META2]]) +// CHECKS: [[DBG13]] = distinct !DISubprogram(name: "testshortmul", scope: [[META7]], file: [[META7]], line: 48, type: [[META14:![0-9]+]], scopeLine: 48, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META2]]) // CHECKS: [[META14]] = !DISubroutineType(types: [[META15:![0-9]+]]) // CHECKS: [[META15]] = !{null} // CHECKS: [[DBG16]] = !DILocation(line: 51, column: 8, scope: [[DBG13]]) -// CHECKS: [[DBG17]] = !DILocation(line: 51, column: 13, scope: [[DBG13]]) -// CHECKS: [[DBG18]] = !DILocation(line: 51, column: 11, scope: [[DBG13]]) -// CHECKS: [[META19]] = !{} -// CHECKS: [[PROF20]] = !{!"branch_weights", i32 1048575, i32 1} -// CHECKS: [[DBG21]] = !DILocation(line: 51, column: 6, scope: [[DBG13]]) -// CHECKS: [[DBG22]] = !DILocation(line: 52, column: 1, scope: [[DBG13]]) +// CHECKS: [[TBAA17]] = !{[[META18:![0-9]+]], [[META18]], i64 0} +// CHECKS: [[META18]] = !{!"short", [[META19:![0-9]+]], i64 0} +// CHECKS: [[META19]] = !{!"omnipotent char", [[META20:![0-9]+]], i64 0} +// CHECKS: [[META20]] = !{!"Simple C/C++ TBAA"} +// CHECKS: [[DBG21]] = !DILocation(line: 51, column: 13, scope: [[DBG13]]) +// CHECKS: [[DBG22]] = !DILocation(line: 51, column: 11, scope: [[DBG13]]) +// CHECKS: [[META23]] = !{} +// CHECKS: [[PROF24]] = !{!"branch_weights", i32 1, i32 1048575} +// CHECKS: [[DBG25]] = !DILocation(line: 51, column: 6, scope: [[DBG13]]) +// CHECKS: [[DBG26]] = !DILocation(line: 52, column: 1, scope: [[DBG13]]) //. // CHECKU: [[META0:![0-9]+]] = !DIGlobalVariableExpression(var: [[META1:![0-9]+]], expr: !DIExpression()) // CHECKU: [[META1]] = distinct !DIGlobalVariable(name: "sj", scope: [[META2:![0-9]+]], file: [[META7:![0-9]+]], line: 12, type: [[META8:![0-9]+]], isLocal: false, isDefinition: true) -// CHECKU: [[META2]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META3:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: [[META4:![0-9]+]], splitDebugInlining: false, nameTableKind: None) -// CHECKU: [[META3]] = !DIFile(filename: "<stdin>", directory: {{.*}}) +// CHECKU: [[META2]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META3:![0-9]+]], isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: [[META4:![0-9]+]], splitDebugInlining: false, nameTableKind: None) +// CHECKU: [[META3]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}}) // CHECKU: [[META4]] = !{[[META5:![0-9]+]], [[META0]], [[META9:![0-9]+]]} // CHECKU: [[META5]] = !DIGlobalVariableExpression(var: [[META6:![0-9]+]], expr: !DIExpression()) // CHECKU: [[META6]] = distinct !DIGlobalVariable(name: "si", scope: [[META2]], file: [[META7]], line: 12, type: [[META8]], isLocal: false, isDefinition: true) @@ -84,12 +84,16 @@ void testshortmul(void) { // CHECKU: [[META8]] = !DIBasicType(name: "unsigned short", size: 16, encoding: DW_ATE_unsigned) // CHECKU: [[META9]] = !DIGlobalVariableExpression(var: [[META10:![0-9]+]], expr: !DIExpression()) // CHECKU: [[META10]] = distinct !DIGlobalVariable(name: "sk", scope: [[META2]], file: [[META7]], line: 12, type: [[META8]], isLocal: false, isDefinition: true) -// CHECKU: [[DBG13]] = distinct !DISubprogram(name: "testshortmul", scope: [[META7]], file: [[META7]], line: 48, type: [[META14:![0-9]+]], scopeLine: 48, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META2]]) +// CHECKU: [[DBG13]] = distinct !DISubprogram(name: "testshortmul", scope: [[META7]], file: [[META7]], line: 48, type: [[META14:![0-9]+]], scopeLine: 48, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META2]]) // CHECKU: [[META14]] = !DISubroutineType(types: [[META15:![0-9]+]]) // CHECKU: [[META15]] = !{null} // CHECKU: [[DBG16]] = !DILocation(line: 51, column: 8, scope: [[DBG13]]) -// CHECKU: [[DBG17]] = !DILocation(line: 51, column: 13, scope: [[DBG13]]) -// CHECKU: [[DBG18]] = !DILocation(line: 51, column: 11, scope: [[DBG13]]) -// CHECKU: [[DBG19]] = !DILocation(line: 51, column: 6, scope: [[DBG13]]) -// CHECKU: [[DBG20]] = !DILocation(line: 52, column: 1, scope: [[DBG13]]) +// CHECKU: [[TBAA17]] = !{[[META18:![0-9]+]], [[META18]], i64 0} +// CHECKU: [[META18]] = !{!"short", [[META19:![0-9]+]], i64 0} +// CHECKU: [[META19]] = !{!"omnipotent char", [[META20:![0-9]+]], i64 0} +// CHECKU: [[META20]] = !{!"Simple C/C++ TBAA"} +// CHECKU: [[DBG21]] = !DILocation(line: 51, column: 13, scope: [[DBG13]]) +// CHECKU: [[DBG22]] = !DILocation(line: 51, column: 11, scope: [[DBG13]]) +// CHECKU: [[DBG23]] = !DILocation(line: 51, column: 6, scope: [[DBG13]]) +// CHECKU: [[DBG24]] = !DILocation(line: 52, column: 1, scope: [[DBG13]]) //. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits