Index: clang/test/Driver/test-cfi.cpp =================================================================== --- /dev/null +++ clang/test/Driver/test-cfi.cpp @@ -0,0 +1,19 @@ +// RUN: %clang -g -fexceptions --target=x86_64-apple-darwin %s -S -emit-llvm -o - | FileCheck %s --check-prefix=X86_64_UWTABLE_EXCEPTIONS +// X86_64_UWTABLE_EXCEPTIONS: attributes #0 = { {{.*}} uwtable +// X86_64_UWTABLE_EXCEPTIONS: !{{[0-9]+}} = !{i32 7, !"uwtable", i32 2} + +// RUN: %clang -g -fno-exceptions --target=x86_64-apple-darwin %s -S -emit-llvm -o - | FileCheck %s --check-prefix=X86_64_UWTABLE +// X86_64_UWTABLE: attributes #0 = { {{.*}} uwtable +// X86_64_UWTABLE: !{{[0-9]+}} = !{i32 7, !"uwtable", i32 2} + +// RUN: %clang -g -fexceptions --target=arm64-apple-darwin %s -S -emit-llvm -o - | FileCheck %s --check-prefix=ARM64_UWTABLE_EXCEPTIONS +// ARM64_UWTABLE_EXCEPTIONS: attributes #0 = { {{.*}} uwtable +// ARM64_UWTABLE_EXCEPTIONS: !{{[0-9]+}} = !{i32 7, !"uwtable", i32 1} + +// RUN: %clang -g -fno-exceptions --target=arm64-apple-darwin %s -S -emit-llvm -o - | FileCheck %s --check-prefix=ARM64_UWTABLE +// ARM64_UWTABLE-NOT: attributes #0 = { {{.*}} uwtable +// ARM64_UWTABLE-NOT: !{{[0-9]+}} = !{i32 7, !"uwtable", i32 2} + +int main() { + return 1; +} Index: llvm/test/DebugInfo/AArch64/test-fexceptions-debug-frame.ll =================================================================== --- /dev/null +++ llvm/test/DebugInfo/AArch64/test-fexceptions-debug-frame.ll @@ -0,0 +1,37 @@ +; RUN: llc --filetype=asm %s -o - | FileCheck %s +; CHECK-NOT: .cfi_sections .debug_frame + +; ModuleID = 'test.cpp' +source_filename = "test.cpp" +target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target triple = "arm64-apple-macosx13.0.0" + +; Function Attrs: noinline norecurse nounwind optnone ssp uwtable(sync) +define i32 @main() #0 !dbg !10 { + %1 = alloca i32, align 4 + store i32 0, ptr %1, align 4 + ret i32 1, !dbg !15 +} + +attributes #0 = { noinline norecurse nounwind optnone ssp uwtable(sync) "frame-pointer"="non-leaf" "min-legal-vector-width"="0" "no-builtin-calloc" "no-builtin-stpcpy" "no-trapping-math"="true" "probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+amx,+amx2,+crc,+crypto,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" } + +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6} +!llvm.dbg.cu = !{!7} +!llvm.ident = !{!9} + +!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 14, i32 0]} +!1 = !{i32 7, !"Dwarf Version", i32 4} +!2 = !{i32 2, !"Debug Info Version", i32 3} +!3 = !{i32 1, !"wchar_size", i32 4} +!4 = !{i32 8, !"PIC Level", i32 2} +!5 = !{i32 7, !"uwtable", i32 1} +!6 = !{i32 7, !"frame-pointer", i32 1} +!7 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !8, producer: "Apple clang version 15.0.0 (clang-1500.0.16.8) [+internal-os]", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None, sysroot: "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.Internal.sdk", sdk: "MacOSX14.0.Internal.sdk") +!8 = !DIFile(filename: "test.cpp", directory: "/Users/shubham/Development/tedk") +!9 = !{!"Apple clang version 15.0.0 (clang-1500.0.16.8) [+internal-os]"} +!10 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 1, type: !11, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !7, retainedNodes: !14) +!11 = !DISubroutineType(types: !12) +!12 = !{!13} +!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!14 = !{} +!15 = !DILocation(line: 2, column: 5, scope: !10) Index: llvm/test/DebugInfo/AArch64/test-fno-exceptions-debug-frame.ll =================================================================== --- /dev/null +++ llvm/test/DebugInfo/AArch64/test-fno-exceptions-debug-frame.ll @@ -0,0 +1,36 @@ +; RUN: llc --filetype=asm %s -o - | FileCheck %s +; CHECK: .cfi_sections .debug_frame + +; ModuleID = 'test.cpp' +source_filename = "test.cpp" +target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" +target triple = "arm64-apple-macosx13.0.0" + +; Function Attrs: noinline norecurse nounwind optnone ssp +define i32 @main() #0 !dbg !9 { + %1 = alloca i32, align 4 + store i32 0, ptr %1, align 4 + ret i32 1, !dbg !14 +} + +attributes #0 = { noinline norecurse nounwind optnone ssp "frame-pointer"="non-leaf" "min-legal-vector-width"="0" "no-builtin-calloc" "no-builtin-stpcpy" "no-trapping-math"="true" "probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+amx,+amx2,+crc,+crypto,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" } + +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5} +!llvm.dbg.cu = !{!6} +!llvm.ident = !{!8} + +!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 14, i32 0]} +!1 = !{i32 7, !"Dwarf Version", i32 4} +!2 = !{i32 2, !"Debug Info Version", i32 3} +!3 = !{i32 1, !"wchar_size", i32 4} +!4 = !{i32 8, !"PIC Level", i32 2} +!5 = !{i32 7, !"frame-pointer", i32 1} +!6 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !7, producer: "Apple clang version 15.0.0 (clang-1500.0.16.8) [+internal-os]", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None, sysroot: "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.Internal.sdk", sdk: "MacOSX14.0.Internal.sdk") +!7 = !DIFile(filename: "test.cpp", directory: "/Users/shubham/Development/tedk") +!8 = !{!"Apple clang version 15.0.0 (clang-1500.0.16.8) [+internal-os]"} +!9 = distinct !DISubprogram(name: "main", scope: !7, file: !7, line: 1, type: !10, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !13) +!10 = !DISubroutineType(types: !11) +!11 = !{!12} +!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!13 = !{} +!14 = !DILocation(line: 2, column: 5, scope: !9) Index: llvm/test/DebugInfo/X86/test-fexceptions-debug-frame.ll =================================================================== --- /dev/null +++ llvm/test/DebugInfo/X86/test-fexceptions-debug-frame.ll @@ -0,0 +1,37 @@ +; RUN: llc --filetype=asm %s -o - | FileCheck %s +; CHECK-NOT: .cfi_sections .debug_frame + +; ModuleID = 'test.cpp' +source_filename = "test.cpp" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx13.0.0" + +; Function Attrs: noinline norecurse nounwind optnone ssp uwtable +define i32 @main() #0 !dbg !10 { + %1 = alloca i32, align 4 + store i32 0, ptr %1, align 4 + ret i32 1, !dbg !15 +} + +attributes #0 = { noinline norecurse nounwind optnone ssp uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtin-calloc" "no-builtin-stpcpy" "no-trapping-math"="true" "probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" } + +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6} +!llvm.dbg.cu = !{!7} +!llvm.ident = !{!9} + +!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 14, i32 0]} +!1 = !{i32 7, !"Dwarf Version", i32 4} +!2 = !{i32 2, !"Debug Info Version", i32 3} +!3 = !{i32 1, !"wchar_size", i32 4} +!4 = !{i32 8, !"PIC Level", i32 2} +!5 = !{i32 7, !"uwtable", i32 2} +!6 = !{i32 7, !"frame-pointer", i32 2} +!7 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !8, producer: "Apple clang version 15.0.0 (clang-1500.0.16.8) [+internal-os]", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None, sysroot: "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.Internal.sdk", sdk: "MacOSX14.0.Internal.sdk") +!8 = !DIFile(filename: "test.cpp", directory: "/Users/shubham/Development/tedk") +!9 = !{!"Apple clang version 15.0.0 (clang-1500.0.16.8) [+internal-os]"} +!10 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 1, type: !11, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !7, retainedNodes: !14) +!11 = !DISubroutineType(types: !12) +!12 = !{!13} +!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!14 = !{} +!15 = !DILocation(line: 2, column: 5, scope: !10) Index: llvm/test/DebugInfo/X86/test-fno-exceptions-debug-frame.ll =================================================================== --- /dev/null +++ llvm/test/DebugInfo/X86/test-fno-exceptions-debug-frame.ll @@ -0,0 +1,37 @@ +; RUN: llc --filetype=asm %s -o - | FileCheck %s +; CHECK-NOT: .cfi_sections .debug_frame + +; ModuleID = 'test.cpp' +source_filename = "test.cpp" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx13.0.0" + +; Function Attrs: noinline norecurse nounwind optnone ssp uwtable +define i32 @main() #0 !dbg !10 { + %1 = alloca i32, align 4 + store i32 0, ptr %1, align 4 + ret i32 1, !dbg !15 +} + +attributes #0 = { noinline norecurse nounwind optnone ssp uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtin-calloc" "no-builtin-stpcpy" "no-trapping-math"="true" "probe-stack"="__chkstk_darwin" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" } + +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6} +!llvm.dbg.cu = !{!7} +!llvm.ident = !{!9} + +!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 14, i32 0]} +!1 = !{i32 7, !"Dwarf Version", i32 4} +!2 = !{i32 2, !"Debug Info Version", i32 3} +!3 = !{i32 1, !"wchar_size", i32 4} +!4 = !{i32 8, !"PIC Level", i32 2} +!5 = !{i32 7, !"uwtable", i32 2} +!6 = !{i32 7, !"frame-pointer", i32 2} +!7 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !8, producer: "Apple clang version 15.0.0 (clang-1500.0.16.8) [+internal-os]", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None, sysroot: "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.Internal.sdk", sdk: "MacOSX14.0.Internal.sdk") +!8 = !DIFile(filename: "test.cpp", directory: "/Users/shubham/Development/tedk") +!9 = !{!"Apple clang version 15.0.0 (clang-1500.0.16.8) [+internal-os]"} +!10 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 1, type: !11, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !7, retainedNodes: !14) +!11 = !DISubroutineType(types: !12) +!12 = !{!13} +!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!14 = !{} +!15 = !DILocation(line: 2, column: 5, scope: !10)