xref: /llvm-project/llvm/test/Transforms/JumpTableToSwitch/remarks.ll (revision d26b43ff4f7396f79de4b099160262c750d6aba7)
1; RUN: opt < %s -passes=jump-table-to-switch -pass-remarks=jump-table-to-switch -S -o /dev/null 2>&1 | FileCheck %s
2
3; CHECK: remark: /tmp/tmp.cc:2:20: expanded indirect call into switch
4
5@func_array = constant [2 x ptr] [ptr @func0, ptr @func1]
6
7define i32 @func0() {
8  ret i32 1
9}
10
11define i32 @func1() {
12  ret i32 2
13}
14
15define i32 @function_with_jump_table(i32 %index) {
16  %gep = getelementptr inbounds [2 x ptr], ptr @func_array, i32 0, i32 %index
17  %func_ptr = load ptr, ptr %gep
18  %result = call i32 %func_ptr(), !dbg !8
19  ret i32 %result
20}
21
22!llvm.dbg.cu = !{!0}
23!llvm.module.flags = !{!3, !4}
24!llvm.ident = !{!5}
25
26!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 18.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2)
27!1 = !DIFile(filename: "/tmp/tmp.cc", directory: "/tmp")
28!2 = !{}
29!3 = !{i32 2, !"Debug Info Version", i32 3}
30!4 = !{i32 1, !"PIC Level", i32 2}
31!5 = !{!"clang version 18.0.0 "}
32!6 = distinct !DISubprogram(name: "success", scope: !1, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)
33!7 = !DISubroutineType(types: !2)
34!8 = !DILocation(line: 2, column: 20, scope: !6)
35!9 = !DILocation(line: 2, column: 21, scope: !6)
36!10 = !DILocation(line: 2, column: 22, scope: !6)
37