[clang] [cfi][NFCI] Pre-commit -fsanitize-annotate-debug-info tests for CFI (PR #139149)
Thurston Dang via cfe-commits
cfe-commits at lists.llvm.org
Thu May 8 14:06:24 PDT 2025
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/139149
>From c2a5ecf9d89b4942fb1e95c7a7713585155099d0 Mon Sep 17 00:00:00 2001
From: Thurston Dang <thurston at google.com>
Date: Thu, 8 May 2025 20:18:22 +0000
Subject: [PATCH 1/2] [cfi][NFCI] Pre-commit -fsanitize-annotate-debug-info
tests for CFI
These tests will show progress as the -fsanitize-annotate-debug-info
plumbing (https://github.com/llvm/llvm-project/pull/138577) gets
connected to CFI check codegen.
---
clang/test/CodeGen/cfi-check-fail-debuginfo.c | 47 ++++++
.../CodeGen/cfi-icall-generalize-debuginfo.c | 134 +++++++++++++++
.../CodeGen/cfi-icall-normalize2-debuginfo.c | 155 ++++++++++++++++++
3 files changed, 336 insertions(+)
create mode 100644 clang/test/CodeGen/cfi-check-fail-debuginfo.c
create mode 100644 clang/test/CodeGen/cfi-icall-generalize-debuginfo.c
create mode 100644 clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c
diff --git a/clang/test/CodeGen/cfi-check-fail-debuginfo.c b/clang/test/CodeGen/cfi-check-fail-debuginfo.c
new file mode 100644
index 0000000000000..024b0eb0191f7
--- /dev/null
+++ b/clang/test/CodeGen/cfi-check-fail-debuginfo.c
@@ -0,0 +1,47 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -O0 -fsanitize-cfi-cross-dso \
+// RUN: -fsanitize=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast \
+// RUN: -fsanitize-trap=cfi-icall,cfi-nvcall -fsanitize-recover=cfi-vcall,cfi-unrelated-cast \
+// RUN: -fsanitize-annotate-debug-info=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast \
+// RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \
+// RUN: -emit-llvm -o - %s | FileCheck %s
+
+// CHECK-LABEL: define dso_local void @caller(
+// CHECK-SAME: ptr noundef [[F:%.*]]) #[[ATTR0:[0-9]+]] !dbg [[DBG6:![0-9]+]] !type [[META14:![0-9]+]] !type [[META15:![0-9]+]] !type [[META16:![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]], [[META17:![0-9]+]], !DIExpression(), [[META18:![0-9]+]])
+// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[F_ADDR]], align 8, !dbg [[DBG19:![0-9]+]]
+// CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[TMP0]], metadata !"_ZTSFvvE"), !dbg [[DBG19]], !nosanitize [[META13:![0-9]+]]
+// CHECK-NEXT: br i1 [[TMP1]], label %[[CFI_CONT:.*]], label %[[CFI_SLOWPATH:.*]], !dbg [[DBG19]], !prof [[PROF20:![0-9]+]], !nosanitize [[META13]]
+// CHECK: [[CFI_SLOWPATH]]:
+// CHECK-NEXT: call void @__cfi_slowpath(i64 9080559750644022485, ptr [[TMP0]]) #[[ATTR7:[0-9]+]], !dbg [[DBG19]], !nosanitize [[META13]]
+// CHECK-NEXT: br label %[[CFI_CONT]], !dbg [[DBG19]], !nosanitize [[META13]]
+// CHECK: [[CFI_CONT]]:
+// CHECK-NEXT: call void [[TMP0]](), !dbg [[DBG19]]
+// CHECK-NEXT: ret void, !dbg [[DBG21:![0-9]+]]
+//
+void caller(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: [[DBG6]] = distinct !DISubprogram(name: "caller", scope: [[META7:![0-9]+]], file: [[META7]], line: 8, type: [[META8:![0-9]+]], scopeLine: 8, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META13]])
+// CHECK: [[META7]] = !DIFile(filename: "{{.*}}cfi-check-fail-debuginfo.c", directory: {{.*}})
+// CHECK: [[META8]] = !DISubroutineType(types: [[META9:![0-9]+]])
+// CHECK: [[META9]] = !{null, [[META10:![0-9]+]]}
+// CHECK: [[META10]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META11:![0-9]+]], size: 64)
+// CHECK: [[META11]] = !DISubroutineType(types: [[META12:![0-9]+]])
+// CHECK: [[META12]] = !{null}
+// CHECK: [[META13]] = !{}
+// CHECK: [[META14]] = !{i64 0, !"_ZTSFvPFvvEE"}
+// CHECK: [[META15]] = !{i64 0, !"_ZTSFvPvE.generalized"}
+// CHECK: [[META16]] = !{i64 0, i64 2451761621477796417}
+// CHECK: [[META17]] = !DILocalVariable(name: "f", arg: 1, scope: [[DBG6]], file: [[META7]], line: 8, type: [[META10]])
+// CHECK: [[META18]] = !DILocation(line: 8, column: 20, scope: [[DBG6]])
+// CHECK: [[DBG19]] = !DILocation(line: 9, column: 3, scope: [[DBG6]])
+// CHECK: [[PROF20]] = !{!"branch_weights", i32 1048575, i32 1}
+// CHECK: [[DBG21]] = !DILocation(line: 10, column: 1, scope: [[DBG6]])
+//.
diff --git a/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c b/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c
new file mode 100644
index 0000000000000..3819adc8a466b
--- /dev/null
+++ b/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c
@@ -0,0 +1,134 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -emit-llvm -o - %s \
+// RUN: -fsanitize-annotate-debug-info=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast \
+// RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \
+// RUN: | FileCheck --check-prefix=CHECK --check-prefix=UNGENERALIZED %s
+//
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -fsanitize-cfi-icall-generalize-pointers -emit-llvm -o - %s \
+// RUN: -fsanitize-annotate-debug-info=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast \
+// RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \
+// RUN: | FileCheck --check-prefix=CHECK --check-prefix=GENERALIZED %s
+
+// Test that const char* is generalized to const ptr and that const char** is
+// generalized to ptr
+
+// CHECK-LABEL: define dso_local ptr @f(
+// CHECK-SAME: ptr noundef [[A:%.*]], ptr noundef [[B:%.*]]) #[[ATTR0:[0-9]+]] !dbg [[DBG9:![0-9]+]] !type [[META18:![0-9]+]] !type [[META19:![0-9]+]] {
+// CHECK-NEXT: [[ENTRY:.*:]]
+// CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
+// CHECK-NEXT: #dbg_declare(ptr [[A_ADDR]], [[META20:![0-9]+]], !DIExpression(), [[META21:![0-9]+]])
+// CHECK-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 8
+// CHECK-NEXT: #dbg_declare(ptr [[B_ADDR]], [[META22:![0-9]+]], !DIExpression(), [[META23:![0-9]+]])
+// CHECK-NEXT: ret ptr null, !dbg [[DBG24:![0-9]+]]
+//
+int** f(const char *a, const char **b) {
+ return (int**)0;
+}
+
+// UNGENERALIZED-LABEL: define dso_local void @g(
+// UNGENERALIZED-SAME: ptr noundef [[FP:%.*]]) #[[ATTR0]] !dbg [[DBG25:![0-9]+]] !type [[META29:![0-9]+]] !type [[META30:![0-9]+]] {
+// UNGENERALIZED-NEXT: [[ENTRY:.*:]]
+// UNGENERALIZED-NEXT: [[FP_ADDR:%.*]] = alloca ptr, align 8
+// UNGENERALIZED-NEXT: store ptr [[FP]], ptr [[FP_ADDR]], align 8
+// UNGENERALIZED-NEXT: #dbg_declare(ptr [[FP_ADDR]], [[META31:![0-9]+]], !DIExpression(), [[META32:![0-9]+]])
+// UNGENERALIZED-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FP_ADDR]], align 8, !dbg [[DBG33:![0-9]+]]
+// UNGENERALIZED-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[TMP0]], metadata !"_ZTSFPPiPKcPS2_E"), !dbg [[DBG33]], !nosanitize [[META17:![0-9]+]]
+// UNGENERALIZED-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG33]], !prof [[PROF34:![0-9]+]], !nosanitize [[META17]]
+// UNGENERALIZED: [[TRAP]]:
+// UNGENERALIZED-NEXT: call void @llvm.ubsantrap(i8 2) #[[ATTR3:[0-9]+]], !dbg [[DBG33]], !nosanitize [[META17]]
+// UNGENERALIZED-NEXT: unreachable, !dbg [[DBG33]], !nosanitize [[META17]]
+// UNGENERALIZED: [[CONT]]:
+// UNGENERALIZED-NEXT: [[CALL:%.*]] = call ptr [[TMP0]](ptr noundef null, ptr noundef null), !dbg [[DBG33]]
+// UNGENERALIZED-NEXT: ret void, !dbg [[DBG35:![0-9]+]]
+//
+// GENERALIZED-LABEL: define dso_local void @g(
+// GENERALIZED-SAME: ptr noundef [[FP:%.*]]) #[[ATTR0]] !dbg [[DBG25:![0-9]+]] !type [[META29:![0-9]+]] !type [[META30:![0-9]+]] {
+// GENERALIZED-NEXT: [[ENTRY:.*:]]
+// GENERALIZED-NEXT: [[FP_ADDR:%.*]] = alloca ptr, align 8
+// GENERALIZED-NEXT: store ptr [[FP]], ptr [[FP_ADDR]], align 8
+// GENERALIZED-NEXT: #dbg_declare(ptr [[FP_ADDR]], [[META31:![0-9]+]], !DIExpression(), [[META32:![0-9]+]])
+// GENERALIZED-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FP_ADDR]], align 8, !dbg [[DBG33:![0-9]+]]
+// GENERALIZED-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[TMP0]], metadata !"_ZTSFPvPKvS_E.generalized"), !dbg [[DBG33]], !nosanitize [[META17:![0-9]+]]
+// GENERALIZED-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG33]], !prof [[PROF34:![0-9]+]], !nosanitize [[META17]]
+// GENERALIZED: [[TRAP]]:
+// GENERALIZED-NEXT: call void @llvm.ubsantrap(i8 2) #[[ATTR3:[0-9]+]], !dbg [[DBG33]], !nosanitize [[META17]]
+// GENERALIZED-NEXT: unreachable, !dbg [[DBG33]], !nosanitize [[META17]]
+// GENERALIZED: [[CONT]]:
+// GENERALIZED-NEXT: [[CALL:%.*]] = call ptr [[TMP0]](ptr noundef null, ptr noundef null), !dbg [[DBG33]]
+// GENERALIZED-NEXT: ret void, !dbg [[DBG35:![0-9]+]]
+//
+void g(int** (*fp)(const char *, const char **)) {
+ fp(0, 0);
+}
+
+//.
+// UNGENERALIZED: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
+// UNGENERALIZED: [[META1]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}})
+// UNGENERALIZED: [[META2]] = !{[[META3:![0-9]+]]}
+// UNGENERALIZED: [[META3]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META4:![0-9]+]], size: 64)
+// UNGENERALIZED: [[META4]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META5:![0-9]+]], size: 64)
+// UNGENERALIZED: [[META5]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+// UNGENERALIZED: [[DBG9]] = distinct !DISubprogram(name: "f", scope: [[META10:![0-9]+]], file: [[META10]], line: 15, type: [[META11:![0-9]+]], scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META17]])
+// UNGENERALIZED: [[META10]] = !DIFile(filename: "{{.*}}cfi-icall-generalize-debuginfo.c", directory: {{.*}})
+// UNGENERALIZED: [[META11]] = !DISubroutineType(types: [[META12:![0-9]+]])
+// UNGENERALIZED: [[META12]] = !{[[META3]], [[META13:![0-9]+]], [[META16:![0-9]+]]}
+// UNGENERALIZED: [[META13]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META14:![0-9]+]], size: 64)
+// UNGENERALIZED: [[META14]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[META15:![0-9]+]])
+// UNGENERALIZED: [[META15]] = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
+// UNGENERALIZED: [[META16]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META13]], size: 64)
+// UNGENERALIZED: [[META17]] = !{}
+// UNGENERALIZED: [[META18]] = !{i64 0, !"_ZTSFPPiPKcPS2_E"}
+// UNGENERALIZED: [[META19]] = !{i64 0, !"_ZTSFPvPKvS_E.generalized"}
+// UNGENERALIZED: [[META20]] = !DILocalVariable(name: "a", arg: 1, scope: [[DBG9]], file: [[META10]], line: 15, type: [[META13]])
+// UNGENERALIZED: [[META21]] = !DILocation(line: 15, column: 21, scope: [[DBG9]])
+// UNGENERALIZED: [[META22]] = !DILocalVariable(name: "b", arg: 2, scope: [[DBG9]], file: [[META10]], line: 15, type: [[META16]])
+// UNGENERALIZED: [[META23]] = !DILocation(line: 15, column: 37, scope: [[DBG9]])
+// UNGENERALIZED: [[DBG24]] = !DILocation(line: 16, column: 3, scope: [[DBG9]])
+// UNGENERALIZED: [[DBG25]] = distinct !DISubprogram(name: "g", scope: [[META10]], file: [[META10]], line: 19, type: [[META26:![0-9]+]], scopeLine: 19, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META17]])
+// UNGENERALIZED: [[META26]] = !DISubroutineType(types: [[META27:![0-9]+]])
+// UNGENERALIZED: [[META27]] = !{null, [[META28:![0-9]+]]}
+// UNGENERALIZED: [[META28]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META11]], size: 64)
+// UNGENERALIZED: [[META29]] = !{i64 0, !"_ZTSFvPFPPiPKcPS2_EE"}
+// UNGENERALIZED: [[META30]] = !{i64 0, !"_ZTSFvPvE.generalized"}
+// UNGENERALIZED: [[META31]] = !DILocalVariable(name: "fp", arg: 1, scope: [[DBG25]], file: [[META10]], line: 19, type: [[META28]])
+// UNGENERALIZED: [[META32]] = !DILocation(line: 19, column: 16, scope: [[DBG25]])
+// UNGENERALIZED: [[DBG33]] = !DILocation(line: 22, column: 3, scope: [[DBG25]])
+// UNGENERALIZED: [[PROF34]] = !{!"branch_weights", i32 1048575, i32 1}
+// UNGENERALIZED: [[DBG35]] = !DILocation(line: 23, column: 1, scope: [[DBG25]])
+//.
+// GENERALIZED: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
+// GENERALIZED: [[META1]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}})
+// GENERALIZED: [[META2]] = !{[[META3:![0-9]+]]}
+// GENERALIZED: [[META3]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META4:![0-9]+]], size: 64)
+// GENERALIZED: [[META4]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META5:![0-9]+]], size: 64)
+// GENERALIZED: [[META5]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+// GENERALIZED: [[DBG9]] = distinct !DISubprogram(name: "f", scope: [[META10:![0-9]+]], file: [[META10]], line: 15, type: [[META11:![0-9]+]], scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META17]])
+// GENERALIZED: [[META10]] = !DIFile(filename: "{{.*}}cfi-icall-generalize-debuginfo.c", directory: {{.*}})
+// GENERALIZED: [[META11]] = !DISubroutineType(types: [[META12:![0-9]+]])
+// GENERALIZED: [[META12]] = !{[[META3]], [[META13:![0-9]+]], [[META16:![0-9]+]]}
+// GENERALIZED: [[META13]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META14:![0-9]+]], size: 64)
+// GENERALIZED: [[META14]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[META15:![0-9]+]])
+// GENERALIZED: [[META15]] = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
+// GENERALIZED: [[META16]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META13]], size: 64)
+// GENERALIZED: [[META17]] = !{}
+// GENERALIZED: [[META18]] = !{i64 0, !"_ZTSFPPiPKcPS2_E"}
+// GENERALIZED: [[META19]] = !{i64 0, !"_ZTSFPvPKvS_E.generalized"}
+// GENERALIZED: [[META20]] = !DILocalVariable(name: "a", arg: 1, scope: [[DBG9]], file: [[META10]], line: 15, type: [[META13]])
+// GENERALIZED: [[META21]] = !DILocation(line: 15, column: 21, scope: [[DBG9]])
+// GENERALIZED: [[META22]] = !DILocalVariable(name: "b", arg: 2, scope: [[DBG9]], file: [[META10]], line: 15, type: [[META16]])
+// GENERALIZED: [[META23]] = !DILocation(line: 15, column: 37, scope: [[DBG9]])
+// GENERALIZED: [[DBG24]] = !DILocation(line: 16, column: 3, scope: [[DBG9]])
+// GENERALIZED: [[DBG25]] = distinct !DISubprogram(name: "g", scope: [[META10]], file: [[META10]], line: 19, type: [[META26:![0-9]+]], scopeLine: 19, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META17]])
+// GENERALIZED: [[META26]] = !DISubroutineType(types: [[META27:![0-9]+]])
+// GENERALIZED: [[META27]] = !{null, [[META28:![0-9]+]]}
+// GENERALIZED: [[META28]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META11]], size: 64)
+// GENERALIZED: [[META29]] = !{i64 0, !"_ZTSFvPFPPiPKcPS2_EE"}
+// GENERALIZED: [[META30]] = !{i64 0, !"_ZTSFvPvE.generalized"}
+// GENERALIZED: [[META31]] = !DILocalVariable(name: "fp", arg: 1, scope: [[DBG25]], file: [[META10]], line: 19, type: [[META28]])
+// GENERALIZED: [[META32]] = !DILocation(line: 19, column: 16, scope: [[DBG25]])
+// GENERALIZED: [[DBG33]] = !DILocation(line: 22, column: 3, scope: [[DBG25]])
+// GENERALIZED: [[PROF34]] = !{!"branch_weights", i32 1048575, i32 1}
+// GENERALIZED: [[DBG35]] = !DILocation(line: 23, column: 1, scope: [[DBG25]])
+//.
diff --git a/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c b/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c
new file mode 100644
index 0000000000000..aa06013c91b9d
--- /dev/null
+++ b/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c
@@ -0,0 +1,155 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -fsanitize-cfi-icall-experimental-normalize-integers -emit-llvm -o - %s \
+// RUN: -fsanitize-annotate-debug-info=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast \
+// RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \
+// RUN: | FileCheck %s
+
+// Test that normalized type metadata for functions are emitted for cross-language CFI support with
+// other languages that can't represent and encode C/C++ integer types.
+
+// CHECK-LABEL: define dso_local void @foo(
+// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG:%.*]]) #[[ATTR0:[0-9]+]] !dbg [[DBG6:![0-9]+]] !type [[META15:![0-9]+]] !type [[META16:![0-9]+]] {
+// CHECK-NEXT: [[ENTRY:.*:]]
+// CHECK-NEXT: [[FN_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT: store ptr [[FN]], ptr [[FN_ADDR]], align 8
+// CHECK-NEXT: #dbg_declare(ptr [[FN_ADDR]], [[META17:![0-9]+]], !DIExpression(), [[META18:![0-9]+]])
+// CHECK-NEXT: store i32 [[ARG]], ptr [[ARG_ADDR]], align 4
+// CHECK-NEXT: #dbg_declare(ptr [[ARG_ADDR]], [[META19:![0-9]+]], !DIExpression(), [[META20:![0-9]+]])
+// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FN_ADDR]], align 8, !dbg [[DBG21:![0-9]+]]
+// CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[TMP0]], metadata !"_ZTSFvu3i32E.normalized"), !dbg [[DBG21]], !nosanitize [[META14:![0-9]+]]
+// CHECK-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG21]], !prof [[PROF22:![0-9]+]], !nosanitize [[META14]]
+// CHECK: [[TRAP]]:
+// CHECK-NEXT: call void @llvm.ubsantrap(i8 2) #[[ATTR3:[0-9]+]], !dbg [[DBG21]], !nosanitize [[META14]]
+// CHECK-NEXT: unreachable, !dbg [[DBG21]], !nosanitize [[META14]]
+// CHECK: [[CONT]]:
+// CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARG_ADDR]], align 4, !dbg [[DBG23:![0-9]+]]
+// CHECK-NEXT: call void [[TMP0]](i32 noundef [[TMP2]]), !dbg [[DBG21]]
+// CHECK-NEXT: ret void, !dbg [[DBG24:![0-9]+]]
+//
+void foo(void (*fn)(int), int arg) {
+ fn(arg);
+}
+
+// CHECK-LABEL: define dso_local void @bar(
+// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG1:%.*]], i32 noundef [[ARG2:%.*]]) #[[ATTR0]] !dbg [[DBG25:![0-9]+]] !type [[META31:![0-9]+]] !type [[META32:![0-9]+]] {
+// CHECK-NEXT: [[ENTRY:.*:]]
+// CHECK-NEXT: [[FN_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-NEXT: [[ARG1_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT: [[ARG2_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT: store ptr [[FN]], ptr [[FN_ADDR]], align 8
+// CHECK-NEXT: #dbg_declare(ptr [[FN_ADDR]], [[META33:![0-9]+]], !DIExpression(), [[META34:![0-9]+]])
+// CHECK-NEXT: store i32 [[ARG1]], ptr [[ARG1_ADDR]], align 4
+// CHECK-NEXT: #dbg_declare(ptr [[ARG1_ADDR]], [[META35:![0-9]+]], !DIExpression(), [[META36:![0-9]+]])
+// CHECK-NEXT: store i32 [[ARG2]], ptr [[ARG2_ADDR]], align 4
+// CHECK-NEXT: #dbg_declare(ptr [[ARG2_ADDR]], [[META37:![0-9]+]], !DIExpression(), [[META38:![0-9]+]])
+// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FN_ADDR]], align 8, !dbg [[DBG39:![0-9]+]]
+// CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[TMP0]], metadata !"_ZTSFvu3i32S_E.normalized"), !dbg [[DBG39]], !nosanitize [[META14]]
+// CHECK-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG39]], !prof [[PROF22]], !nosanitize [[META14]]
+// CHECK: [[TRAP]]:
+// CHECK-NEXT: call void @llvm.ubsantrap(i8 2) #[[ATTR3]], !dbg [[DBG39]], !nosanitize [[META14]]
+// CHECK-NEXT: unreachable, !dbg [[DBG39]], !nosanitize [[META14]]
+// CHECK: [[CONT]]:
+// CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARG1_ADDR]], align 4, !dbg [[DBG40:![0-9]+]]
+// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[ARG2_ADDR]], align 4, !dbg [[DBG41:![0-9]+]]
+// CHECK-NEXT: call void [[TMP0]](i32 noundef [[TMP2]], i32 noundef [[TMP3]]), !dbg [[DBG39]]
+// CHECK-NEXT: ret void, !dbg [[DBG42:![0-9]+]]
+//
+void bar(void (*fn)(int, int), int arg1, int arg2) {
+ fn(arg1, arg2);
+}
+
+// CHECK-LABEL: define dso_local void @baz(
+// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG1:%.*]], i32 noundef [[ARG2:%.*]], i32 noundef [[ARG3:%.*]]) #[[ATTR0]] !dbg [[DBG43:![0-9]+]] !type [[META49:![0-9]+]] !type [[META50:![0-9]+]] {
+// CHECK-NEXT: [[ENTRY:.*:]]
+// CHECK-NEXT: [[FN_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-NEXT: [[ARG1_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT: [[ARG2_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT: [[ARG3_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT: store ptr [[FN]], ptr [[FN_ADDR]], align 8
+// CHECK-NEXT: #dbg_declare(ptr [[FN_ADDR]], [[META51:![0-9]+]], !DIExpression(), [[META52:![0-9]+]])
+// CHECK-NEXT: store i32 [[ARG1]], ptr [[ARG1_ADDR]], align 4
+// CHECK-NEXT: #dbg_declare(ptr [[ARG1_ADDR]], [[META53:![0-9]+]], !DIExpression(), [[META54:![0-9]+]])
+// CHECK-NEXT: store i32 [[ARG2]], ptr [[ARG2_ADDR]], align 4
+// CHECK-NEXT: #dbg_declare(ptr [[ARG2_ADDR]], [[META55:![0-9]+]], !DIExpression(), [[META56:![0-9]+]])
+// CHECK-NEXT: store i32 [[ARG3]], ptr [[ARG3_ADDR]], align 4
+// CHECK-NEXT: #dbg_declare(ptr [[ARG3_ADDR]], [[META57:![0-9]+]], !DIExpression(), [[META58:![0-9]+]])
+// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FN_ADDR]], align 8, !dbg [[DBG59:![0-9]+]]
+// CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[TMP0]], metadata !"_ZTSFvu3i32S_S_E.normalized"), !dbg [[DBG59]], !nosanitize [[META14]]
+// CHECK-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG59]], !prof [[PROF22]], !nosanitize [[META14]]
+// CHECK: [[TRAP]]:
+// CHECK-NEXT: call void @llvm.ubsantrap(i8 2) #[[ATTR3]], !dbg [[DBG59]], !nosanitize [[META14]]
+// CHECK-NEXT: unreachable, !dbg [[DBG59]], !nosanitize [[META14]]
+// CHECK: [[CONT]]:
+// CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARG1_ADDR]], align 4, !dbg [[DBG60:![0-9]+]]
+// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[ARG2_ADDR]], align 4, !dbg [[DBG61:![0-9]+]]
+// CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr [[ARG3_ADDR]], align 4, !dbg [[DBG62:![0-9]+]]
+// CHECK-NEXT: call void [[TMP0]](i32 noundef [[TMP2]], i32 noundef [[TMP3]], i32 noundef [[TMP4]]), !dbg [[DBG59]]
+// CHECK-NEXT: ret void, !dbg [[DBG63:![0-9]+]]
+//
+void baz(void (*fn)(int, int, int), int arg1, int arg2, int arg3) {
+ fn(arg1, arg2, arg3);
+}
+
+//.
+// 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: [[DBG6]] = distinct !DISubprogram(name: "foo", scope: [[META7:![0-9]+]], file: [[META7]], line: 9, type: [[META8:![0-9]+]], scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META14]])
+// CHECK: [[META7]] = !DIFile(filename: "{{.*}}cfi-icall-normalize2-debuginfo.c", directory: {{.*}})
+// CHECK: [[META8]] = !DISubroutineType(types: [[META9:![0-9]+]])
+// CHECK: [[META9]] = !{null, [[META10:![0-9]+]], [[META13:![0-9]+]]}
+// CHECK: [[META10]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META11:![0-9]+]], size: 64)
+// CHECK: [[META11]] = !DISubroutineType(types: [[META12:![0-9]+]])
+// CHECK: [[META12]] = !{null, [[META13]]}
+// CHECK: [[META13]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+// CHECK: [[META14]] = !{}
+// CHECK: [[META15]] = !{i64 0, !"_ZTSFvPFvu3i32ES_E.normalized"}
+// CHECK: [[META16]] = !{i64 0, !"_ZTSFvPvu3i32E.normalized.generalized"}
+// CHECK: [[META17]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG6]], file: [[META7]], line: 9, type: [[META10]])
+// CHECK: [[META18]] = !DILocation(line: 9, column: 17, scope: [[DBG6]])
+// CHECK: [[META19]] = !DILocalVariable(name: "arg", arg: 2, scope: [[DBG6]], file: [[META7]], line: 9, type: [[META13]])
+// CHECK: [[META20]] = !DILocation(line: 9, column: 31, scope: [[DBG6]])
+// CHECK: [[DBG21]] = !DILocation(line: 13, column: 5, scope: [[DBG6]])
+// CHECK: [[PROF22]] = !{!"branch_weights", i32 1048575, i32 1}
+// CHECK: [[DBG23]] = !DILocation(line: 13, column: 8, scope: [[DBG6]])
+// CHECK: [[DBG24]] = !DILocation(line: 14, column: 1, scope: [[DBG6]])
+// CHECK: [[DBG25]] = distinct !DISubprogram(name: "bar", scope: [[META7]], file: [[META7]], line: 16, type: [[META26:![0-9]+]], scopeLine: 16, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META14]])
+// CHECK: [[META26]] = !DISubroutineType(types: [[META27:![0-9]+]])
+// CHECK: [[META27]] = !{null, [[META28:![0-9]+]], [[META13]], [[META13]]}
+// CHECK: [[META28]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META29:![0-9]+]], size: 64)
+// CHECK: [[META29]] = !DISubroutineType(types: [[META30:![0-9]+]])
+// CHECK: [[META30]] = !{null, [[META13]], [[META13]]}
+// CHECK: [[META31]] = !{i64 0, !"_ZTSFvPFvu3i32S_ES_S_E.normalized"}
+// CHECK: [[META32]] = !{i64 0, !"_ZTSFvPvu3i32S0_E.normalized.generalized"}
+// CHECK: [[META33]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG25]], file: [[META7]], line: 16, type: [[META28]])
+// CHECK: [[META34]] = !DILocation(line: 16, column: 17, scope: [[DBG25]])
+// CHECK: [[META35]] = !DILocalVariable(name: "arg1", arg: 2, scope: [[DBG25]], file: [[META7]], line: 16, type: [[META13]])
+// CHECK: [[META36]] = !DILocation(line: 16, column: 36, scope: [[DBG25]])
+// CHECK: [[META37]] = !DILocalVariable(name: "arg2", arg: 3, scope: [[DBG25]], file: [[META7]], line: 16, type: [[META13]])
+// CHECK: [[META38]] = !DILocation(line: 16, column: 46, scope: [[DBG25]])
+// CHECK: [[DBG39]] = !DILocation(line: 20, column: 5, scope: [[DBG25]])
+// CHECK: [[DBG40]] = !DILocation(line: 20, column: 8, scope: [[DBG25]])
+// CHECK: [[DBG41]] = !DILocation(line: 20, column: 14, scope: [[DBG25]])
+// CHECK: [[DBG42]] = !DILocation(line: 21, column: 1, scope: [[DBG25]])
+// CHECK: [[DBG43]] = distinct !DISubprogram(name: "baz", scope: [[META7]], file: [[META7]], line: 23, type: [[META44:![0-9]+]], scopeLine: 23, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META14]])
+// CHECK: [[META44]] = !DISubroutineType(types: [[META45:![0-9]+]])
+// CHECK: [[META45]] = !{null, [[META46:![0-9]+]], [[META13]], [[META13]], [[META13]]}
+// CHECK: [[META46]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META47:![0-9]+]], size: 64)
+// CHECK: [[META47]] = !DISubroutineType(types: [[META48:![0-9]+]])
+// CHECK: [[META48]] = !{null, [[META13]], [[META13]], [[META13]]}
+// CHECK: [[META49]] = !{i64 0, !"_ZTSFvPFvu3i32S_S_ES_S_S_E.normalized"}
+// CHECK: [[META50]] = !{i64 0, !"_ZTSFvPvu3i32S0_S0_E.normalized.generalized"}
+// CHECK: [[META51]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG43]], file: [[META7]], line: 23, type: [[META46]])
+// CHECK: [[META52]] = !DILocation(line: 23, column: 17, scope: [[DBG43]])
+// CHECK: [[META53]] = !DILocalVariable(name: "arg1", arg: 2, scope: [[DBG43]], file: [[META7]], line: 23, type: [[META13]])
+// CHECK: [[META54]] = !DILocation(line: 23, column: 41, scope: [[DBG43]])
+// CHECK: [[META55]] = !DILocalVariable(name: "arg2", arg: 3, scope: [[DBG43]], file: [[META7]], line: 23, type: [[META13]])
+// CHECK: [[META56]] = !DILocation(line: 23, column: 51, scope: [[DBG43]])
+// CHECK: [[META57]] = !DILocalVariable(name: "arg3", arg: 4, scope: [[DBG43]], file: [[META7]], line: 23, type: [[META13]])
+// CHECK: [[META58]] = !DILocation(line: 23, column: 61, scope: [[DBG43]])
+// CHECK: [[DBG59]] = !DILocation(line: 27, column: 5, scope: [[DBG43]])
+// CHECK: [[DBG60]] = !DILocation(line: 27, column: 8, scope: [[DBG43]])
+// CHECK: [[DBG61]] = !DILocation(line: 27, column: 14, scope: [[DBG43]])
+// CHECK: [[DBG62]] = !DILocation(line: 27, column: 20, scope: [[DBG43]])
+// CHECK: [[DBG63]] = !DILocation(line: 28, column: 1, scope: [[DBG43]])
+//.
>From d5ea43fd6cba8ba1be4d6c28c992b8e51f1634fb Mon Sep 17 00:00:00 2001
From: Thurston Dang <thurston at google.com>
Date: Thu, 8 May 2025 21:06:03 +0000
Subject: [PATCH 2/2] Use -O2
---
clang/test/CodeGen/cfi-check-fail-debuginfo.c | 56 +++---
.../CodeGen/cfi-icall-generalize-debuginfo.c | 160 +++++++--------
.../CodeGen/cfi-icall-normalize2-debuginfo.c | 188 +++++++-----------
3 files changed, 179 insertions(+), 225 deletions(-)
diff --git a/clang/test/CodeGen/cfi-check-fail-debuginfo.c b/clang/test/CodeGen/cfi-check-fail-debuginfo.c
index 024b0eb0191f7..fb3f0fd680e08 100644
--- a/clang/test/CodeGen/cfi-check-fail-debuginfo.c
+++ b/clang/test/CodeGen/cfi-check-fail-debuginfo.c
@@ -1,5 +1,5 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
-// RUN: %clang_cc1 -triple x86_64-unknown-linux -O0 -fsanitize-cfi-cross-dso \
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -O2 -fsanitize-cfi-cross-dso \
// RUN: -fsanitize=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast \
// RUN: -fsanitize-trap=cfi-icall,cfi-nvcall -fsanitize-recover=cfi-vcall,cfi-unrelated-cast \
// RUN: -fsanitize-annotate-debug-info=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast \
@@ -7,41 +7,39 @@
// RUN: -emit-llvm -o - %s | FileCheck %s
// CHECK-LABEL: define dso_local void @caller(
-// CHECK-SAME: ptr noundef [[F:%.*]]) #[[ATTR0:[0-9]+]] !dbg [[DBG6:![0-9]+]] !type [[META14:![0-9]+]] !type [[META15:![0-9]+]] !type [[META16:![0-9]+]] {
+// CHECK-SAME: ptr noundef [[F:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] !dbg [[DBG7:![0-9]+]] !type [[META16:![0-9]+]] !type [[META17:![0-9]+]] !type [[META18:![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]], [[META17:![0-9]+]], !DIExpression(), [[META18:![0-9]+]])
-// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[F_ADDR]], align 8, !dbg [[DBG19:![0-9]+]]
-// CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[TMP0]], metadata !"_ZTSFvvE"), !dbg [[DBG19]], !nosanitize [[META13:![0-9]+]]
-// CHECK-NEXT: br i1 [[TMP1]], label %[[CFI_CONT:.*]], label %[[CFI_SLOWPATH:.*]], !dbg [[DBG19]], !prof [[PROF20:![0-9]+]], !nosanitize [[META13]]
+// CHECK-NEXT: #dbg_value(ptr [[F]], [[META15:![0-9]+]], !DIExpression(), [[META19:![0-9]+]])
+// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[F]], metadata !"_ZTSFvvE"), !dbg [[DBG20:![0-9]+]], !nosanitize [[META21:![0-9]+]]
+// CHECK-NEXT: br i1 [[TMP0]], label %[[CFI_CONT:.*]], label %[[CFI_SLOWPATH:.*]], !dbg [[DBG20]], !prof [[PROF22:![0-9]+]], !nosanitize [[META21]]
// CHECK: [[CFI_SLOWPATH]]:
-// CHECK-NEXT: call void @__cfi_slowpath(i64 9080559750644022485, ptr [[TMP0]]) #[[ATTR7:[0-9]+]], !dbg [[DBG19]], !nosanitize [[META13]]
-// CHECK-NEXT: br label %[[CFI_CONT]], !dbg [[DBG19]], !nosanitize [[META13]]
+// CHECK-NEXT: tail call void @__cfi_slowpath(i64 9080559750644022485, ptr [[F]]) #[[ATTR6:[0-9]+]], !dbg [[DBG20]], !nosanitize [[META21]]
+// CHECK-NEXT: br label %[[CFI_CONT]], !dbg [[DBG20]], !nosanitize [[META21]]
// CHECK: [[CFI_CONT]]:
-// CHECK-NEXT: call void [[TMP0]](), !dbg [[DBG19]]
-// CHECK-NEXT: ret void, !dbg [[DBG21:![0-9]+]]
+// CHECK-NEXT: tail call void [[F]]() #[[ATTR6]], !dbg [[DBG20]]
+// CHECK-NEXT: ret void, !dbg [[DBG23:![0-9]+]]
//
void caller(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: [[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: [[DBG6]] = distinct !DISubprogram(name: "caller", scope: [[META7:![0-9]+]], file: [[META7]], line: 8, type: [[META8:![0-9]+]], scopeLine: 8, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META13]])
-// CHECK: [[META7]] = !DIFile(filename: "{{.*}}cfi-check-fail-debuginfo.c", directory: {{.*}})
-// CHECK: [[META8]] = !DISubroutineType(types: [[META9:![0-9]+]])
-// CHECK: [[META9]] = !{null, [[META10:![0-9]+]]}
-// CHECK: [[META10]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META11:![0-9]+]], size: 64)
-// CHECK: [[META11]] = !DISubroutineType(types: [[META12:![0-9]+]])
-// CHECK: [[META12]] = !{null}
-// CHECK: [[META13]] = !{}
-// CHECK: [[META14]] = !{i64 0, !"_ZTSFvPFvvEE"}
-// CHECK: [[META15]] = !{i64 0, !"_ZTSFvPvE.generalized"}
-// CHECK: [[META16]] = !{i64 0, i64 2451761621477796417}
-// CHECK: [[META17]] = !DILocalVariable(name: "f", arg: 1, scope: [[DBG6]], file: [[META7]], line: 8, type: [[META10]])
-// CHECK: [[META18]] = !DILocation(line: 8, column: 20, scope: [[DBG6]])
-// CHECK: [[DBG19]] = !DILocation(line: 9, column: 3, scope: [[DBG6]])
-// CHECK: [[PROF20]] = !{!"branch_weights", i32 1048575, i32 1}
-// CHECK: [[DBG21]] = !DILocation(line: 10, column: 1, scope: [[DBG6]])
+// CHECK: [[DBG7]] = distinct !DISubprogram(name: "caller", scope: [[META8:![0-9]+]], file: [[META8]], line: 25, type: [[META9:![0-9]+]], scopeLine: 25, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META14:![0-9]+]])
+// CHECK: [[META8]] = !DIFile(filename: "{{.*}}cfi-check-fail-debuginfo.c", directory: {{.*}})
+// CHECK: [[META9]] = !DISubroutineType(types: [[META10:![0-9]+]])
+// CHECK: [[META10]] = !{null, [[META11:![0-9]+]]}
+// CHECK: [[META11]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META12:![0-9]+]], size: 64)
+// CHECK: [[META12]] = !DISubroutineType(types: [[META13:![0-9]+]])
+// CHECK: [[META13]] = !{null}
+// CHECK: [[META14]] = !{[[META15]]}
+// CHECK: [[META15]] = !DILocalVariable(name: "f", arg: 1, scope: [[DBG7]], file: [[META8]], line: 25, type: [[META11]])
+// CHECK: [[META16]] = !{i64 0, !"_ZTSFvPFvvEE"}
+// CHECK: [[META17]] = !{i64 0, !"_ZTSFvPvE.generalized"}
+// CHECK: [[META18]] = !{i64 0, i64 2451761621477796417}
+// CHECK: [[META19]] = !DILocation(line: 0, scope: [[DBG7]])
+// CHECK: [[DBG20]] = !DILocation(line: 26, column: 3, scope: [[DBG7]])
+// CHECK: [[META21]] = !{}
+// CHECK: [[PROF22]] = !{!"branch_weights", i32 1048575, i32 1}
+// CHECK: [[DBG23]] = !DILocation(line: 27, column: 1, scope: [[DBG7]])
//.
diff --git a/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c b/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c
index 3819adc8a466b..e6db09e697379 100644
--- a/clang/test/CodeGen/cfi-icall-generalize-debuginfo.c
+++ b/clang/test/CodeGen/cfi-icall-generalize-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-unknown-linux -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -emit-llvm -o - %s \
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -O2 -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -emit-llvm -o - %s \
// RUN: -fsanitize-annotate-debug-info=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast \
// RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \
// RUN: | FileCheck --check-prefix=CHECK --check-prefix=UNGENERALIZED %s
//
-// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -fsanitize-cfi-icall-generalize-pointers -emit-llvm -o - %s \
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -O2 -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -fsanitize-cfi-icall-generalize-pointers -emit-llvm -o - %s \
// RUN: -fsanitize-annotate-debug-info=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast \
// RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \
// RUN: | FileCheck --check-prefix=CHECK --check-prefix=GENERALIZED %s
@@ -12,15 +12,11 @@
// Test that const char* is generalized to const ptr and that const char** is
// generalized to ptr
-// CHECK-LABEL: define dso_local ptr @f(
-// CHECK-SAME: ptr noundef [[A:%.*]], ptr noundef [[B:%.*]]) #[[ATTR0:[0-9]+]] !dbg [[DBG9:![0-9]+]] !type [[META18:![0-9]+]] !type [[META19:![0-9]+]] {
+// CHECK-LABEL: define dso_local noalias noundef ptr @f(
+// CHECK-SAME: ptr noundef readnone captures(none) [[A:%.*]], ptr noundef readnone captures(none) [[B:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] !dbg [[DBG10:![0-9]+]] !type [[META21:![0-9]+]] !type [[META22:![0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
-// CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
-// CHECK-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
-// CHECK-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
-// CHECK-NEXT: #dbg_declare(ptr [[A_ADDR]], [[META20:![0-9]+]], !DIExpression(), [[META21:![0-9]+]])
-// CHECK-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 8
-// CHECK-NEXT: #dbg_declare(ptr [[B_ADDR]], [[META22:![0-9]+]], !DIExpression(), [[META23:![0-9]+]])
+// CHECK-NEXT: #dbg_value(ptr [[A]], [[META19:![0-9]+]], !DIExpression(), [[META23:![0-9]+]])
+// CHECK-NEXT: #dbg_value(ptr [[B]], [[META20:![0-9]+]], !DIExpression(), [[META23]])
// CHECK-NEXT: ret ptr null, !dbg [[DBG24:![0-9]+]]
//
int** f(const char *a, const char **b) {
@@ -28,107 +24,103 @@ int** f(const char *a, const char **b) {
}
// UNGENERALIZED-LABEL: define dso_local void @g(
-// UNGENERALIZED-SAME: ptr noundef [[FP:%.*]]) #[[ATTR0]] !dbg [[DBG25:![0-9]+]] !type [[META29:![0-9]+]] !type [[META30:![0-9]+]] {
+// UNGENERALIZED-SAME: ptr noundef [[FP:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] !dbg [[DBG25:![0-9]+]] !type [[META31:![0-9]+]] !type [[META32:![0-9]+]] {
// UNGENERALIZED-NEXT: [[ENTRY:.*:]]
-// UNGENERALIZED-NEXT: [[FP_ADDR:%.*]] = alloca ptr, align 8
-// UNGENERALIZED-NEXT: store ptr [[FP]], ptr [[FP_ADDR]], align 8
-// UNGENERALIZED-NEXT: #dbg_declare(ptr [[FP_ADDR]], [[META31:![0-9]+]], !DIExpression(), [[META32:![0-9]+]])
-// UNGENERALIZED-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FP_ADDR]], align 8, !dbg [[DBG33:![0-9]+]]
-// UNGENERALIZED-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[TMP0]], metadata !"_ZTSFPPiPKcPS2_E"), !dbg [[DBG33]], !nosanitize [[META17:![0-9]+]]
-// UNGENERALIZED-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG33]], !prof [[PROF34:![0-9]+]], !nosanitize [[META17]]
+// UNGENERALIZED-NEXT: #dbg_value(ptr [[FP]], [[META30:![0-9]+]], !DIExpression(), [[META33:![0-9]+]])
+// UNGENERALIZED-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FP]], metadata !"_ZTSFPPiPKcPS2_E"), !dbg [[DBG34:![0-9]+]], !nosanitize [[META35:![0-9]+]]
+// UNGENERALIZED-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG34]], !prof [[PROF36:![0-9]+]], !nosanitize [[META35]]
// UNGENERALIZED: [[TRAP]]:
-// UNGENERALIZED-NEXT: call void @llvm.ubsantrap(i8 2) #[[ATTR3:[0-9]+]], !dbg [[DBG33]], !nosanitize [[META17]]
-// UNGENERALIZED-NEXT: unreachable, !dbg [[DBG33]], !nosanitize [[META17]]
+// UNGENERALIZED-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR4:[0-9]+]], !dbg [[DBG34]], !nosanitize [[META35]]
+// UNGENERALIZED-NEXT: unreachable, !dbg [[DBG34]], !nosanitize [[META35]]
// UNGENERALIZED: [[CONT]]:
-// UNGENERALIZED-NEXT: [[CALL:%.*]] = call ptr [[TMP0]](ptr noundef null, ptr noundef null), !dbg [[DBG33]]
-// UNGENERALIZED-NEXT: ret void, !dbg [[DBG35:![0-9]+]]
+// UNGENERALIZED-NEXT: [[CALL:%.*]] = tail call ptr [[FP]](ptr noundef null, ptr noundef null) #[[ATTR5:[0-9]+]], !dbg [[DBG34]]
+// UNGENERALIZED-NEXT: ret void, !dbg [[DBG37:![0-9]+]]
//
// GENERALIZED-LABEL: define dso_local void @g(
-// GENERALIZED-SAME: ptr noundef [[FP:%.*]]) #[[ATTR0]] !dbg [[DBG25:![0-9]+]] !type [[META29:![0-9]+]] !type [[META30:![0-9]+]] {
+// GENERALIZED-SAME: ptr noundef [[FP:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] !dbg [[DBG25:![0-9]+]] !type [[META31:![0-9]+]] !type [[META32:![0-9]+]] {
// GENERALIZED-NEXT: [[ENTRY:.*:]]
-// GENERALIZED-NEXT: [[FP_ADDR:%.*]] = alloca ptr, align 8
-// GENERALIZED-NEXT: store ptr [[FP]], ptr [[FP_ADDR]], align 8
-// GENERALIZED-NEXT: #dbg_declare(ptr [[FP_ADDR]], [[META31:![0-9]+]], !DIExpression(), [[META32:![0-9]+]])
-// GENERALIZED-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FP_ADDR]], align 8, !dbg [[DBG33:![0-9]+]]
-// GENERALIZED-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[TMP0]], metadata !"_ZTSFPvPKvS_E.generalized"), !dbg [[DBG33]], !nosanitize [[META17:![0-9]+]]
-// GENERALIZED-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG33]], !prof [[PROF34:![0-9]+]], !nosanitize [[META17]]
+// GENERALIZED-NEXT: #dbg_value(ptr [[FP]], [[META30:![0-9]+]], !DIExpression(), [[META33:![0-9]+]])
+// GENERALIZED-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FP]], metadata !"_ZTSFPvPKvS_E.generalized"), !dbg [[DBG34:![0-9]+]], !nosanitize [[META35:![0-9]+]]
+// GENERALIZED-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG34]], !prof [[PROF36:![0-9]+]], !nosanitize [[META35]]
// GENERALIZED: [[TRAP]]:
-// GENERALIZED-NEXT: call void @llvm.ubsantrap(i8 2) #[[ATTR3:[0-9]+]], !dbg [[DBG33]], !nosanitize [[META17]]
-// GENERALIZED-NEXT: unreachable, !dbg [[DBG33]], !nosanitize [[META17]]
+// GENERALIZED-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR4:[0-9]+]], !dbg [[DBG34]], !nosanitize [[META35]]
+// GENERALIZED-NEXT: unreachable, !dbg [[DBG34]], !nosanitize [[META35]]
// GENERALIZED: [[CONT]]:
-// GENERALIZED-NEXT: [[CALL:%.*]] = call ptr [[TMP0]](ptr noundef null, ptr noundef null), !dbg [[DBG33]]
-// GENERALIZED-NEXT: ret void, !dbg [[DBG35:![0-9]+]]
+// GENERALIZED-NEXT: [[CALL:%.*]] = tail call ptr [[FP]](ptr noundef null, ptr noundef null) #[[ATTR5:[0-9]+]], !dbg [[DBG34]]
+// GENERALIZED-NEXT: ret void, !dbg [[DBG37:![0-9]+]]
//
void g(int** (*fp)(const char *, const char **)) {
fp(0, 0);
}
//.
-// UNGENERALIZED: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
+// UNGENERALIZED: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
// UNGENERALIZED: [[META1]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}})
// UNGENERALIZED: [[META2]] = !{[[META3:![0-9]+]]}
// UNGENERALIZED: [[META3]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META4:![0-9]+]], size: 64)
// UNGENERALIZED: [[META4]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META5:![0-9]+]], size: 64)
// UNGENERALIZED: [[META5]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-// UNGENERALIZED: [[DBG9]] = distinct !DISubprogram(name: "f", scope: [[META10:![0-9]+]], file: [[META10]], line: 15, type: [[META11:![0-9]+]], scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META17]])
-// UNGENERALIZED: [[META10]] = !DIFile(filename: "{{.*}}cfi-icall-generalize-debuginfo.c", directory: {{.*}})
-// UNGENERALIZED: [[META11]] = !DISubroutineType(types: [[META12:![0-9]+]])
-// UNGENERALIZED: [[META12]] = !{[[META3]], [[META13:![0-9]+]], [[META16:![0-9]+]]}
-// UNGENERALIZED: [[META13]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META14:![0-9]+]], size: 64)
-// UNGENERALIZED: [[META14]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[META15:![0-9]+]])
-// UNGENERALIZED: [[META15]] = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
-// UNGENERALIZED: [[META16]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META13]], size: 64)
-// UNGENERALIZED: [[META17]] = !{}
-// UNGENERALIZED: [[META18]] = !{i64 0, !"_ZTSFPPiPKcPS2_E"}
-// UNGENERALIZED: [[META19]] = !{i64 0, !"_ZTSFPvPKvS_E.generalized"}
-// UNGENERALIZED: [[META20]] = !DILocalVariable(name: "a", arg: 1, scope: [[DBG9]], file: [[META10]], line: 15, type: [[META13]])
-// UNGENERALIZED: [[META21]] = !DILocation(line: 15, column: 21, scope: [[DBG9]])
-// UNGENERALIZED: [[META22]] = !DILocalVariable(name: "b", arg: 2, scope: [[DBG9]], file: [[META10]], line: 15, type: [[META16]])
-// UNGENERALIZED: [[META23]] = !DILocation(line: 15, column: 37, scope: [[DBG9]])
-// UNGENERALIZED: [[DBG24]] = !DILocation(line: 16, column: 3, scope: [[DBG9]])
-// UNGENERALIZED: [[DBG25]] = distinct !DISubprogram(name: "g", scope: [[META10]], file: [[META10]], line: 19, type: [[META26:![0-9]+]], scopeLine: 19, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META17]])
+// UNGENERALIZED: [[DBG10]] = distinct !DISubprogram(name: "f", scope: [[META11:![0-9]+]], file: [[META11]], line: 26, type: [[META12:![0-9]+]], scopeLine: 26, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META18:![0-9]+]])
+// UNGENERALIZED: [[META11]] = !DIFile(filename: "{{.*}}cfi-icall-generalize-debuginfo.c", directory: {{.*}})
+// UNGENERALIZED: [[META12]] = !DISubroutineType(types: [[META13:![0-9]+]])
+// UNGENERALIZED: [[META13]] = !{[[META3]], [[META14:![0-9]+]], [[META17:![0-9]+]]}
+// UNGENERALIZED: [[META14]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META15:![0-9]+]], size: 64)
+// UNGENERALIZED: [[META15]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[META16:![0-9]+]])
+// UNGENERALIZED: [[META16]] = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
+// UNGENERALIZED: [[META17]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META14]], size: 64)
+// UNGENERALIZED: [[META18]] = !{[[META19]], [[META20]]}
+// UNGENERALIZED: [[META19]] = !DILocalVariable(name: "a", arg: 1, scope: [[DBG10]], file: [[META11]], line: 26, type: [[META14]])
+// UNGENERALIZED: [[META20]] = !DILocalVariable(name: "b", arg: 2, scope: [[DBG10]], file: [[META11]], line: 26, type: [[META17]])
+// UNGENERALIZED: [[META21]] = !{i64 0, !"_ZTSFPPiPKcPS2_E"}
+// UNGENERALIZED: [[META22]] = !{i64 0, !"_ZTSFPvPKvS_E.generalized"}
+// UNGENERALIZED: [[META23]] = !DILocation(line: 0, scope: [[DBG10]])
+// UNGENERALIZED: [[DBG24]] = !DILocation(line: 27, column: 3, scope: [[DBG10]])
+// UNGENERALIZED: [[DBG25]] = distinct !DISubprogram(name: "g", scope: [[META11]], file: [[META11]], line: 62, type: [[META26:![0-9]+]], scopeLine: 62, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META29:![0-9]+]])
// UNGENERALIZED: [[META26]] = !DISubroutineType(types: [[META27:![0-9]+]])
// UNGENERALIZED: [[META27]] = !{null, [[META28:![0-9]+]]}
-// UNGENERALIZED: [[META28]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META11]], size: 64)
-// UNGENERALIZED: [[META29]] = !{i64 0, !"_ZTSFvPFPPiPKcPS2_EE"}
-// UNGENERALIZED: [[META30]] = !{i64 0, !"_ZTSFvPvE.generalized"}
-// UNGENERALIZED: [[META31]] = !DILocalVariable(name: "fp", arg: 1, scope: [[DBG25]], file: [[META10]], line: 19, type: [[META28]])
-// UNGENERALIZED: [[META32]] = !DILocation(line: 19, column: 16, scope: [[DBG25]])
-// UNGENERALIZED: [[DBG33]] = !DILocation(line: 22, column: 3, scope: [[DBG25]])
-// UNGENERALIZED: [[PROF34]] = !{!"branch_weights", i32 1048575, i32 1}
-// UNGENERALIZED: [[DBG35]] = !DILocation(line: 23, column: 1, scope: [[DBG25]])
+// UNGENERALIZED: [[META28]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META12]], size: 64)
+// UNGENERALIZED: [[META29]] = !{[[META30]]}
+// UNGENERALIZED: [[META30]] = !DILocalVariable(name: "fp", arg: 1, scope: [[DBG25]], file: [[META11]], line: 62, type: [[META28]])
+// UNGENERALIZED: [[META31]] = !{i64 0, !"_ZTSFvPFPPiPKcPS2_EE"}
+// UNGENERALIZED: [[META32]] = !{i64 0, !"_ZTSFvPvE.generalized"}
+// UNGENERALIZED: [[META33]] = !DILocation(line: 0, scope: [[DBG25]])
+// UNGENERALIZED: [[DBG34]] = !DILocation(line: 63, column: 3, scope: [[DBG25]])
+// UNGENERALIZED: [[META35]] = !{}
+// UNGENERALIZED: [[PROF36]] = !{!"branch_weights", i32 1048575, i32 1}
+// UNGENERALIZED: [[DBG37]] = !DILocation(line: 64, column: 1, scope: [[DBG25]])
//.
-// GENERALIZED: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
+// GENERALIZED: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
// GENERALIZED: [[META1]] = !DIFile(filename: "{{.*}}<stdin>", directory: {{.*}})
// GENERALIZED: [[META2]] = !{[[META3:![0-9]+]]}
// GENERALIZED: [[META3]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META4:![0-9]+]], size: 64)
// GENERALIZED: [[META4]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META5:![0-9]+]], size: 64)
// GENERALIZED: [[META5]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-// GENERALIZED: [[DBG9]] = distinct !DISubprogram(name: "f", scope: [[META10:![0-9]+]], file: [[META10]], line: 15, type: [[META11:![0-9]+]], scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META17]])
-// GENERALIZED: [[META10]] = !DIFile(filename: "{{.*}}cfi-icall-generalize-debuginfo.c", directory: {{.*}})
-// GENERALIZED: [[META11]] = !DISubroutineType(types: [[META12:![0-9]+]])
-// GENERALIZED: [[META12]] = !{[[META3]], [[META13:![0-9]+]], [[META16:![0-9]+]]}
-// GENERALIZED: [[META13]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META14:![0-9]+]], size: 64)
-// GENERALIZED: [[META14]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[META15:![0-9]+]])
-// GENERALIZED: [[META15]] = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
-// GENERALIZED: [[META16]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META13]], size: 64)
-// GENERALIZED: [[META17]] = !{}
-// GENERALIZED: [[META18]] = !{i64 0, !"_ZTSFPPiPKcPS2_E"}
-// GENERALIZED: [[META19]] = !{i64 0, !"_ZTSFPvPKvS_E.generalized"}
-// GENERALIZED: [[META20]] = !DILocalVariable(name: "a", arg: 1, scope: [[DBG9]], file: [[META10]], line: 15, type: [[META13]])
-// GENERALIZED: [[META21]] = !DILocation(line: 15, column: 21, scope: [[DBG9]])
-// GENERALIZED: [[META22]] = !DILocalVariable(name: "b", arg: 2, scope: [[DBG9]], file: [[META10]], line: 15, type: [[META16]])
-// GENERALIZED: [[META23]] = !DILocation(line: 15, column: 37, scope: [[DBG9]])
-// GENERALIZED: [[DBG24]] = !DILocation(line: 16, column: 3, scope: [[DBG9]])
-// GENERALIZED: [[DBG25]] = distinct !DISubprogram(name: "g", scope: [[META10]], file: [[META10]], line: 19, type: [[META26:![0-9]+]], scopeLine: 19, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META17]])
+// GENERALIZED: [[DBG10]] = distinct !DISubprogram(name: "f", scope: [[META11:![0-9]+]], file: [[META11]], line: 26, type: [[META12:![0-9]+]], scopeLine: 26, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META18:![0-9]+]])
+// GENERALIZED: [[META11]] = !DIFile(filename: "{{.*}}cfi-icall-generalize-debuginfo.c", directory: {{.*}})
+// GENERALIZED: [[META12]] = !DISubroutineType(types: [[META13:![0-9]+]])
+// GENERALIZED: [[META13]] = !{[[META3]], [[META14:![0-9]+]], [[META17:![0-9]+]]}
+// GENERALIZED: [[META14]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META15:![0-9]+]], size: 64)
+// GENERALIZED: [[META15]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[META16:![0-9]+]])
+// GENERALIZED: [[META16]] = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
+// GENERALIZED: [[META17]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META14]], size: 64)
+// GENERALIZED: [[META18]] = !{[[META19]], [[META20]]}
+// GENERALIZED: [[META19]] = !DILocalVariable(name: "a", arg: 1, scope: [[DBG10]], file: [[META11]], line: 26, type: [[META14]])
+// GENERALIZED: [[META20]] = !DILocalVariable(name: "b", arg: 2, scope: [[DBG10]], file: [[META11]], line: 26, type: [[META17]])
+// GENERALIZED: [[META21]] = !{i64 0, !"_ZTSFPPiPKcPS2_E"}
+// GENERALIZED: [[META22]] = !{i64 0, !"_ZTSFPvPKvS_E.generalized"}
+// GENERALIZED: [[META23]] = !DILocation(line: 0, scope: [[DBG10]])
+// GENERALIZED: [[DBG24]] = !DILocation(line: 27, column: 3, scope: [[DBG10]])
+// GENERALIZED: [[DBG25]] = distinct !DISubprogram(name: "g", scope: [[META11]], file: [[META11]], line: 62, type: [[META26:![0-9]+]], scopeLine: 62, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META29:![0-9]+]])
// GENERALIZED: [[META26]] = !DISubroutineType(types: [[META27:![0-9]+]])
// GENERALIZED: [[META27]] = !{null, [[META28:![0-9]+]]}
-// GENERALIZED: [[META28]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META11]], size: 64)
-// GENERALIZED: [[META29]] = !{i64 0, !"_ZTSFvPFPPiPKcPS2_EE"}
-// GENERALIZED: [[META30]] = !{i64 0, !"_ZTSFvPvE.generalized"}
-// GENERALIZED: [[META31]] = !DILocalVariable(name: "fp", arg: 1, scope: [[DBG25]], file: [[META10]], line: 19, type: [[META28]])
-// GENERALIZED: [[META32]] = !DILocation(line: 19, column: 16, scope: [[DBG25]])
-// GENERALIZED: [[DBG33]] = !DILocation(line: 22, column: 3, scope: [[DBG25]])
-// GENERALIZED: [[PROF34]] = !{!"branch_weights", i32 1048575, i32 1}
-// GENERALIZED: [[DBG35]] = !DILocation(line: 23, column: 1, scope: [[DBG25]])
+// GENERALIZED: [[META28]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META12]], size: 64)
+// GENERALIZED: [[META29]] = !{[[META30]]}
+// GENERALIZED: [[META30]] = !DILocalVariable(name: "fp", arg: 1, scope: [[DBG25]], file: [[META11]], line: 62, type: [[META28]])
+// GENERALIZED: [[META31]] = !{i64 0, !"_ZTSFvPFPPiPKcPS2_EE"}
+// GENERALIZED: [[META32]] = !{i64 0, !"_ZTSFvPvE.generalized"}
+// GENERALIZED: [[META33]] = !DILocation(line: 0, scope: [[DBG25]])
+// GENERALIZED: [[DBG34]] = !DILocation(line: 63, column: 3, scope: [[DBG25]])
+// GENERALIZED: [[META35]] = !{}
+// GENERALIZED: [[PROF36]] = !{!"branch_weights", i32 1048575, i32 1}
+// GENERALIZED: [[DBG37]] = !DILocation(line: 64, column: 1, scope: [[DBG25]])
//.
diff --git a/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c b/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c
index aa06013c91b9d..68fa014a6f7e2 100644
--- a/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c
+++ b/clang/test/CodeGen/cfi-icall-normalize2-debuginfo.c
@@ -1,5 +1,5 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
-// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -fsanitize-cfi-icall-experimental-normalize-integers -emit-llvm -o - %s \
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -O2 -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -fsanitize-cfi-icall-experimental-normalize-integers -emit-llvm -o - %s \
// RUN: -fsanitize-annotate-debug-info=cfi-icall,cfi-nvcall,cfi-vcall,cfi-unrelated-cast,cfi-derived-cast \
// RUN: -fdebug-prefix-map=%S/= -fno-ident -fdebug-compilation-dir=%S -debug-info-kind=limited \
// RUN: | FileCheck %s
@@ -8,23 +8,17 @@
// other languages that can't represent and encode C/C++ integer types.
// CHECK-LABEL: define dso_local void @foo(
-// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG:%.*]]) #[[ATTR0:[0-9]+]] !dbg [[DBG6:![0-9]+]] !type [[META15:![0-9]+]] !type [[META16:![0-9]+]] {
+// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] !dbg [[DBG7:![0-9]+]] !type [[META18:![0-9]+]] !type [[META19:![0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
-// CHECK-NEXT: [[FN_ADDR:%.*]] = alloca ptr, align 8
-// CHECK-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4
-// CHECK-NEXT: store ptr [[FN]], ptr [[FN_ADDR]], align 8
-// CHECK-NEXT: #dbg_declare(ptr [[FN_ADDR]], [[META17:![0-9]+]], !DIExpression(), [[META18:![0-9]+]])
-// CHECK-NEXT: store i32 [[ARG]], ptr [[ARG_ADDR]], align 4
-// CHECK-NEXT: #dbg_declare(ptr [[ARG_ADDR]], [[META19:![0-9]+]], !DIExpression(), [[META20:![0-9]+]])
-// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FN_ADDR]], align 8, !dbg [[DBG21:![0-9]+]]
-// CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[TMP0]], metadata !"_ZTSFvu3i32E.normalized"), !dbg [[DBG21]], !nosanitize [[META14:![0-9]+]]
-// CHECK-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG21]], !prof [[PROF22:![0-9]+]], !nosanitize [[META14]]
+// CHECK-NEXT: #dbg_value(ptr [[FN]], [[META16:![0-9]+]], !DIExpression(), [[META20:![0-9]+]])
+// CHECK-NEXT: #dbg_value(i32 [[ARG]], [[META17:![0-9]+]], !DIExpression(), [[META20]])
+// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FN]], metadata !"_ZTSFvu3i32E.normalized"), !dbg [[DBG21:![0-9]+]], !nosanitize [[META22:![0-9]+]]
+// CHECK-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG21]], !prof [[PROF23:![0-9]+]], !nosanitize [[META22]]
// CHECK: [[TRAP]]:
-// CHECK-NEXT: call void @llvm.ubsantrap(i8 2) #[[ATTR3:[0-9]+]], !dbg [[DBG21]], !nosanitize [[META14]]
-// CHECK-NEXT: unreachable, !dbg [[DBG21]], !nosanitize [[META14]]
+// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR3:[0-9]+]], !dbg [[DBG21]], !nosanitize [[META22]]
+// CHECK-NEXT: unreachable, !dbg [[DBG21]], !nosanitize [[META22]]
// CHECK: [[CONT]]:
-// CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARG_ADDR]], align 4, !dbg [[DBG23:![0-9]+]]
-// CHECK-NEXT: call void [[TMP0]](i32 noundef [[TMP2]]), !dbg [[DBG21]]
+// CHECK-NEXT: tail call void [[FN]](i32 noundef [[ARG]]) #[[ATTR4:[0-9]+]], !dbg [[DBG21]]
// CHECK-NEXT: ret void, !dbg [[DBG24:![0-9]+]]
//
void foo(void (*fn)(int), int arg) {
@@ -32,124 +26,94 @@ void foo(void (*fn)(int), int arg) {
}
// CHECK-LABEL: define dso_local void @bar(
-// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG1:%.*]], i32 noundef [[ARG2:%.*]]) #[[ATTR0]] !dbg [[DBG25:![0-9]+]] !type [[META31:![0-9]+]] !type [[META32:![0-9]+]] {
+// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG1:%.*]], i32 noundef [[ARG2:%.*]]) local_unnamed_addr #[[ATTR0]] !dbg [[DBG25:![0-9]+]] !type [[META35:![0-9]+]] !type [[META36:![0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
-// CHECK-NEXT: [[FN_ADDR:%.*]] = alloca ptr, align 8
-// CHECK-NEXT: [[ARG1_ADDR:%.*]] = alloca i32, align 4
-// CHECK-NEXT: [[ARG2_ADDR:%.*]] = alloca i32, align 4
-// CHECK-NEXT: store ptr [[FN]], ptr [[FN_ADDR]], align 8
-// CHECK-NEXT: #dbg_declare(ptr [[FN_ADDR]], [[META33:![0-9]+]], !DIExpression(), [[META34:![0-9]+]])
-// CHECK-NEXT: store i32 [[ARG1]], ptr [[ARG1_ADDR]], align 4
-// CHECK-NEXT: #dbg_declare(ptr [[ARG1_ADDR]], [[META35:![0-9]+]], !DIExpression(), [[META36:![0-9]+]])
-// CHECK-NEXT: store i32 [[ARG2]], ptr [[ARG2_ADDR]], align 4
-// CHECK-NEXT: #dbg_declare(ptr [[ARG2_ADDR]], [[META37:![0-9]+]], !DIExpression(), [[META38:![0-9]+]])
-// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FN_ADDR]], align 8, !dbg [[DBG39:![0-9]+]]
-// CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[TMP0]], metadata !"_ZTSFvu3i32S_E.normalized"), !dbg [[DBG39]], !nosanitize [[META14]]
-// CHECK-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG39]], !prof [[PROF22]], !nosanitize [[META14]]
+// CHECK-NEXT: #dbg_value(ptr [[FN]], [[META32:![0-9]+]], !DIExpression(), [[META37:![0-9]+]])
+// CHECK-NEXT: #dbg_value(i32 [[ARG1]], [[META33:![0-9]+]], !DIExpression(), [[META37]])
+// CHECK-NEXT: #dbg_value(i32 [[ARG2]], [[META34:![0-9]+]], !DIExpression(), [[META37]])
+// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FN]], metadata !"_ZTSFvu3i32S_E.normalized"), !dbg [[DBG38:![0-9]+]], !nosanitize [[META22]]
+// CHECK-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG38]], !prof [[PROF23]], !nosanitize [[META22]]
// CHECK: [[TRAP]]:
-// CHECK-NEXT: call void @llvm.ubsantrap(i8 2) #[[ATTR3]], !dbg [[DBG39]], !nosanitize [[META14]]
-// CHECK-NEXT: unreachable, !dbg [[DBG39]], !nosanitize [[META14]]
+// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR3]], !dbg [[DBG38]], !nosanitize [[META22]]
+// CHECK-NEXT: unreachable, !dbg [[DBG38]], !nosanitize [[META22]]
// CHECK: [[CONT]]:
-// CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARG1_ADDR]], align 4, !dbg [[DBG40:![0-9]+]]
-// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[ARG2_ADDR]], align 4, !dbg [[DBG41:![0-9]+]]
-// CHECK-NEXT: call void [[TMP0]](i32 noundef [[TMP2]], i32 noundef [[TMP3]]), !dbg [[DBG39]]
-// CHECK-NEXT: ret void, !dbg [[DBG42:![0-9]+]]
+// CHECK-NEXT: tail call void [[FN]](i32 noundef [[ARG1]], i32 noundef [[ARG2]]) #[[ATTR4]], !dbg [[DBG38]]
+// CHECK-NEXT: ret void, !dbg [[DBG39:![0-9]+]]
//
void bar(void (*fn)(int, int), int arg1, int arg2) {
fn(arg1, arg2);
}
// CHECK-LABEL: define dso_local void @baz(
-// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG1:%.*]], i32 noundef [[ARG2:%.*]], i32 noundef [[ARG3:%.*]]) #[[ATTR0]] !dbg [[DBG43:![0-9]+]] !type [[META49:![0-9]+]] !type [[META50:![0-9]+]] {
+// CHECK-SAME: ptr noundef [[FN:%.*]], i32 noundef [[ARG1:%.*]], i32 noundef [[ARG2:%.*]], i32 noundef [[ARG3:%.*]]) local_unnamed_addr #[[ATTR0]] !dbg [[DBG40:![0-9]+]] !type [[META51:![0-9]+]] !type [[META52:![0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
-// CHECK-NEXT: [[FN_ADDR:%.*]] = alloca ptr, align 8
-// CHECK-NEXT: [[ARG1_ADDR:%.*]] = alloca i32, align 4
-// CHECK-NEXT: [[ARG2_ADDR:%.*]] = alloca i32, align 4
-// CHECK-NEXT: [[ARG3_ADDR:%.*]] = alloca i32, align 4
-// CHECK-NEXT: store ptr [[FN]], ptr [[FN_ADDR]], align 8
-// CHECK-NEXT: #dbg_declare(ptr [[FN_ADDR]], [[META51:![0-9]+]], !DIExpression(), [[META52:![0-9]+]])
-// CHECK-NEXT: store i32 [[ARG1]], ptr [[ARG1_ADDR]], align 4
-// CHECK-NEXT: #dbg_declare(ptr [[ARG1_ADDR]], [[META53:![0-9]+]], !DIExpression(), [[META54:![0-9]+]])
-// CHECK-NEXT: store i32 [[ARG2]], ptr [[ARG2_ADDR]], align 4
-// CHECK-NEXT: #dbg_declare(ptr [[ARG2_ADDR]], [[META55:![0-9]+]], !DIExpression(), [[META56:![0-9]+]])
-// CHECK-NEXT: store i32 [[ARG3]], ptr [[ARG3_ADDR]], align 4
-// CHECK-NEXT: #dbg_declare(ptr [[ARG3_ADDR]], [[META57:![0-9]+]], !DIExpression(), [[META58:![0-9]+]])
-// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[FN_ADDR]], align 8, !dbg [[DBG59:![0-9]+]]
-// CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.type.test(ptr [[TMP0]], metadata !"_ZTSFvu3i32S_S_E.normalized"), !dbg [[DBG59]], !nosanitize [[META14]]
-// CHECK-NEXT: br i1 [[TMP1]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG59]], !prof [[PROF22]], !nosanitize [[META14]]
+// CHECK-NEXT: #dbg_value(ptr [[FN]], [[META47:![0-9]+]], !DIExpression(), [[META53:![0-9]+]])
+// CHECK-NEXT: #dbg_value(i32 [[ARG1]], [[META48:![0-9]+]], !DIExpression(), [[META53]])
+// CHECK-NEXT: #dbg_value(i32 [[ARG2]], [[META49:![0-9]+]], !DIExpression(), [[META53]])
+// CHECK-NEXT: #dbg_value(i32 [[ARG3]], [[META50:![0-9]+]], !DIExpression(), [[META53]])
+// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.type.test(ptr [[FN]], metadata !"_ZTSFvu3i32S_S_E.normalized"), !dbg [[DBG54:![0-9]+]], !nosanitize [[META22]]
+// CHECK-NEXT: br i1 [[TMP0]], label %[[CONT:.*]], label %[[TRAP:.*]], !dbg [[DBG54]], !prof [[PROF23]], !nosanitize [[META22]]
// CHECK: [[TRAP]]:
-// CHECK-NEXT: call void @llvm.ubsantrap(i8 2) #[[ATTR3]], !dbg [[DBG59]], !nosanitize [[META14]]
-// CHECK-NEXT: unreachable, !dbg [[DBG59]], !nosanitize [[META14]]
+// CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR3]], !dbg [[DBG54]], !nosanitize [[META22]]
+// CHECK-NEXT: unreachable, !dbg [[DBG54]], !nosanitize [[META22]]
// CHECK: [[CONT]]:
-// CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARG1_ADDR]], align 4, !dbg [[DBG60:![0-9]+]]
-// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[ARG2_ADDR]], align 4, !dbg [[DBG61:![0-9]+]]
-// CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr [[ARG3_ADDR]], align 4, !dbg [[DBG62:![0-9]+]]
-// CHECK-NEXT: call void [[TMP0]](i32 noundef [[TMP2]], i32 noundef [[TMP3]], i32 noundef [[TMP4]]), !dbg [[DBG59]]
-// CHECK-NEXT: ret void, !dbg [[DBG63:![0-9]+]]
+// CHECK-NEXT: tail call void [[FN]](i32 noundef [[ARG1]], i32 noundef [[ARG2]], i32 noundef [[ARG3]]) #[[ATTR4]], !dbg [[DBG54]]
+// CHECK-NEXT: ret void, !dbg [[DBG55:![0-9]+]]
//
void baz(void (*fn)(int, int, int), int arg1, int arg2, int arg3) {
fn(arg1, arg2, arg3);
}
//.
-// 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: [[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: [[DBG6]] = distinct !DISubprogram(name: "foo", scope: [[META7:![0-9]+]], file: [[META7]], line: 9, type: [[META8:![0-9]+]], scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META14]])
-// CHECK: [[META7]] = !DIFile(filename: "{{.*}}cfi-icall-normalize2-debuginfo.c", directory: {{.*}})
-// CHECK: [[META8]] = !DISubroutineType(types: [[META9:![0-9]+]])
-// CHECK: [[META9]] = !{null, [[META10:![0-9]+]], [[META13:![0-9]+]]}
-// CHECK: [[META10]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META11:![0-9]+]], size: 64)
-// CHECK: [[META11]] = !DISubroutineType(types: [[META12:![0-9]+]])
-// CHECK: [[META12]] = !{null, [[META13]]}
-// CHECK: [[META13]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-// CHECK: [[META14]] = !{}
-// CHECK: [[META15]] = !{i64 0, !"_ZTSFvPFvu3i32ES_E.normalized"}
-// CHECK: [[META16]] = !{i64 0, !"_ZTSFvPvu3i32E.normalized.generalized"}
-// CHECK: [[META17]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG6]], file: [[META7]], line: 9, type: [[META10]])
-// CHECK: [[META18]] = !DILocation(line: 9, column: 17, scope: [[DBG6]])
-// CHECK: [[META19]] = !DILocalVariable(name: "arg", arg: 2, scope: [[DBG6]], file: [[META7]], line: 9, type: [[META13]])
-// CHECK: [[META20]] = !DILocation(line: 9, column: 31, scope: [[DBG6]])
-// CHECK: [[DBG21]] = !DILocation(line: 13, column: 5, scope: [[DBG6]])
-// CHECK: [[PROF22]] = !{!"branch_weights", i32 1048575, i32 1}
-// CHECK: [[DBG23]] = !DILocation(line: 13, column: 8, scope: [[DBG6]])
-// CHECK: [[DBG24]] = !DILocation(line: 14, column: 1, scope: [[DBG6]])
-// CHECK: [[DBG25]] = distinct !DISubprogram(name: "bar", scope: [[META7]], file: [[META7]], line: 16, type: [[META26:![0-9]+]], scopeLine: 16, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META14]])
+// CHECK: [[DBG7]] = distinct !DISubprogram(name: "foo", scope: [[META8:![0-9]+]], file: [[META8]], line: 30, type: [[META9:![0-9]+]], scopeLine: 30, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META15:![0-9]+]])
+// CHECK: [[META8]] = !DIFile(filename: "{{.*}}cfi-icall-normalize2-debuginfo.c", directory: {{.*}})
+// CHECK: [[META9]] = !DISubroutineType(types: [[META10:![0-9]+]])
+// CHECK: [[META10]] = !{null, [[META11:![0-9]+]], [[META14:![0-9]+]]}
+// CHECK: [[META11]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META12:![0-9]+]], size: 64)
+// CHECK: [[META12]] = !DISubroutineType(types: [[META13:![0-9]+]])
+// CHECK: [[META13]] = !{null, [[META14]]}
+// CHECK: [[META14]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+// CHECK: [[META15]] = !{[[META16]], [[META17]]}
+// CHECK: [[META16]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG7]], file: [[META8]], line: 30, type: [[META11]])
+// CHECK: [[META17]] = !DILocalVariable(name: "arg", arg: 2, scope: [[DBG7]], file: [[META8]], line: 30, type: [[META14]])
+// CHECK: [[META18]] = !{i64 0, !"_ZTSFvPFvu3i32ES_E.normalized"}
+// CHECK: [[META19]] = !{i64 0, !"_ZTSFvPvu3i32E.normalized.generalized"}
+// CHECK: [[META20]] = !DILocation(line: 0, scope: [[DBG7]])
+// CHECK: [[DBG21]] = !DILocation(line: 31, column: 5, scope: [[DBG7]])
+// CHECK: [[META22]] = !{}
+// CHECK: [[PROF23]] = !{!"branch_weights", i32 1048575, i32 1}
+// CHECK: [[DBG24]] = !DILocation(line: 32, column: 1, scope: [[DBG7]])
+// CHECK: [[DBG25]] = distinct !DISubprogram(name: "bar", scope: [[META8]], file: [[META8]], line: 58, type: [[META26:![0-9]+]], scopeLine: 58, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META31:![0-9]+]])
// CHECK: [[META26]] = !DISubroutineType(types: [[META27:![0-9]+]])
-// CHECK: [[META27]] = !{null, [[META28:![0-9]+]], [[META13]], [[META13]]}
+// CHECK: [[META27]] = !{null, [[META28:![0-9]+]], [[META14]], [[META14]]}
// CHECK: [[META28]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META29:![0-9]+]], size: 64)
// CHECK: [[META29]] = !DISubroutineType(types: [[META30:![0-9]+]])
-// CHECK: [[META30]] = !{null, [[META13]], [[META13]]}
-// CHECK: [[META31]] = !{i64 0, !"_ZTSFvPFvu3i32S_ES_S_E.normalized"}
-// CHECK: [[META32]] = !{i64 0, !"_ZTSFvPvu3i32S0_E.normalized.generalized"}
-// CHECK: [[META33]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG25]], file: [[META7]], line: 16, type: [[META28]])
-// CHECK: [[META34]] = !DILocation(line: 16, column: 17, scope: [[DBG25]])
-// CHECK: [[META35]] = !DILocalVariable(name: "arg1", arg: 2, scope: [[DBG25]], file: [[META7]], line: 16, type: [[META13]])
-// CHECK: [[META36]] = !DILocation(line: 16, column: 36, scope: [[DBG25]])
-// CHECK: [[META37]] = !DILocalVariable(name: "arg2", arg: 3, scope: [[DBG25]], file: [[META7]], line: 16, type: [[META13]])
-// CHECK: [[META38]] = !DILocation(line: 16, column: 46, scope: [[DBG25]])
-// CHECK: [[DBG39]] = !DILocation(line: 20, column: 5, scope: [[DBG25]])
-// CHECK: [[DBG40]] = !DILocation(line: 20, column: 8, scope: [[DBG25]])
-// CHECK: [[DBG41]] = !DILocation(line: 20, column: 14, scope: [[DBG25]])
-// CHECK: [[DBG42]] = !DILocation(line: 21, column: 1, scope: [[DBG25]])
-// CHECK: [[DBG43]] = distinct !DISubprogram(name: "baz", scope: [[META7]], file: [[META7]], line: 23, type: [[META44:![0-9]+]], scopeLine: 23, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META14]])
+// CHECK: [[META30]] = !{null, [[META14]], [[META14]]}
+// CHECK: [[META31]] = !{[[META32]], [[META33]], [[META34]]}
+// CHECK: [[META32]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG25]], file: [[META8]], line: 58, type: [[META28]])
+// CHECK: [[META33]] = !DILocalVariable(name: "arg1", arg: 2, scope: [[DBG25]], file: [[META8]], line: 58, type: [[META14]])
+// CHECK: [[META34]] = !DILocalVariable(name: "arg2", arg: 3, scope: [[DBG25]], file: [[META8]], line: 58, type: [[META14]])
+// CHECK: [[META35]] = !{i64 0, !"_ZTSFvPFvu3i32S_ES_S_E.normalized"}
+// CHECK: [[META36]] = !{i64 0, !"_ZTSFvPvu3i32S0_E.normalized.generalized"}
+// CHECK: [[META37]] = !DILocation(line: 0, scope: [[DBG25]])
+// CHECK: [[DBG38]] = !DILocation(line: 59, column: 5, scope: [[DBG25]])
+// CHECK: [[DBG39]] = !DILocation(line: 60, column: 1, scope: [[DBG25]])
+// CHECK: [[DBG40]] = distinct !DISubprogram(name: "baz", scope: [[META8]], file: [[META8]], line: 90, type: [[META41:![0-9]+]], scopeLine: 90, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META46:![0-9]+]])
+// CHECK: [[META41]] = !DISubroutineType(types: [[META42:![0-9]+]])
+// CHECK: [[META42]] = !{null, [[META43:![0-9]+]], [[META14]], [[META14]], [[META14]]}
+// CHECK: [[META43]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META44:![0-9]+]], size: 64)
// CHECK: [[META44]] = !DISubroutineType(types: [[META45:![0-9]+]])
-// CHECK: [[META45]] = !{null, [[META46:![0-9]+]], [[META13]], [[META13]], [[META13]]}
-// CHECK: [[META46]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META47:![0-9]+]], size: 64)
-// CHECK: [[META47]] = !DISubroutineType(types: [[META48:![0-9]+]])
-// CHECK: [[META48]] = !{null, [[META13]], [[META13]], [[META13]]}
-// CHECK: [[META49]] = !{i64 0, !"_ZTSFvPFvu3i32S_S_ES_S_S_E.normalized"}
-// CHECK: [[META50]] = !{i64 0, !"_ZTSFvPvu3i32S0_S0_E.normalized.generalized"}
-// CHECK: [[META51]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG43]], file: [[META7]], line: 23, type: [[META46]])
-// CHECK: [[META52]] = !DILocation(line: 23, column: 17, scope: [[DBG43]])
-// CHECK: [[META53]] = !DILocalVariable(name: "arg1", arg: 2, scope: [[DBG43]], file: [[META7]], line: 23, type: [[META13]])
-// CHECK: [[META54]] = !DILocation(line: 23, column: 41, scope: [[DBG43]])
-// CHECK: [[META55]] = !DILocalVariable(name: "arg2", arg: 3, scope: [[DBG43]], file: [[META7]], line: 23, type: [[META13]])
-// CHECK: [[META56]] = !DILocation(line: 23, column: 51, scope: [[DBG43]])
-// CHECK: [[META57]] = !DILocalVariable(name: "arg3", arg: 4, scope: [[DBG43]], file: [[META7]], line: 23, type: [[META13]])
-// CHECK: [[META58]] = !DILocation(line: 23, column: 61, scope: [[DBG43]])
-// CHECK: [[DBG59]] = !DILocation(line: 27, column: 5, scope: [[DBG43]])
-// CHECK: [[DBG60]] = !DILocation(line: 27, column: 8, scope: [[DBG43]])
-// CHECK: [[DBG61]] = !DILocation(line: 27, column: 14, scope: [[DBG43]])
-// CHECK: [[DBG62]] = !DILocation(line: 27, column: 20, scope: [[DBG43]])
-// CHECK: [[DBG63]] = !DILocation(line: 28, column: 1, scope: [[DBG43]])
+// CHECK: [[META45]] = !{null, [[META14]], [[META14]], [[META14]]}
+// CHECK: [[META46]] = !{[[META47]], [[META48]], [[META49]], [[META50]]}
+// CHECK: [[META47]] = !DILocalVariable(name: "fn", arg: 1, scope: [[DBG40]], file: [[META8]], line: 90, type: [[META43]])
+// CHECK: [[META48]] = !DILocalVariable(name: "arg1", arg: 2, scope: [[DBG40]], file: [[META8]], line: 90, type: [[META14]])
+// CHECK: [[META49]] = !DILocalVariable(name: "arg2", arg: 3, scope: [[DBG40]], file: [[META8]], line: 90, type: [[META14]])
+// CHECK: [[META50]] = !DILocalVariable(name: "arg3", arg: 4, scope: [[DBG40]], file: [[META8]], line: 90, type: [[META14]])
+// CHECK: [[META51]] = !{i64 0, !"_ZTSFvPFvu3i32S_S_ES_S_S_E.normalized"}
+// CHECK: [[META52]] = !{i64 0, !"_ZTSFvPvu3i32S0_S0_E.normalized.generalized"}
+// CHECK: [[META53]] = !DILocation(line: 0, scope: [[DBG40]])
+// CHECK: [[DBG54]] = !DILocation(line: 91, column: 5, scope: [[DBG40]])
+// CHECK: [[DBG55]] = !DILocation(line: 92, column: 1, scope: [[DBG40]])
//.
More information about the cfe-commits
mailing list