xref: /aosp_15_r20/external/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -simplifycfg -S < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker%0 = type { i32*, i32* }
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker@0 = external hidden constant [5 x %0], align 4
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine void @foo(i32) nounwind ssp !dbg !0 {
8*9880d681SAndroid Build Coastguard WorkerEntry:
9*9880d681SAndroid Build Coastguard Worker  %1 = icmp slt i32 %0, 0, !dbg !5
10*9880d681SAndroid Build Coastguard Worker  br i1 %1, label %BB5, label %BB1, !dbg !5
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard WorkerBB1:                                              ; preds = %Entry
13*9880d681SAndroid Build Coastguard Worker  %2 = icmp sgt i32 %0, 4, !dbg !5
14*9880d681SAndroid Build Coastguard Worker  br i1 %2, label %BB5, label %BB2, !dbg !5
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard WorkerBB2:                                              ; preds = %BB1
17*9880d681SAndroid Build Coastguard Worker  %3 = shl i32 1, %0, !dbg !5
18*9880d681SAndroid Build Coastguard Worker  %4 = and i32 %3, 31, !dbg !5
19*9880d681SAndroid Build Coastguard Worker  %5 = icmp eq i32 %4, 0, !dbg !5
20*9880d681SAndroid Build Coastguard Worker  br i1 %5, label %BB5, label %BB3, !dbg !5
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker;CHECK: icmp eq
23*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: getelementptr
24*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: icmp eq
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard WorkerBB3:                                              ; preds = %BB2
27*9880d681SAndroid Build Coastguard Worker  %6 = getelementptr inbounds [5 x %0], [5 x %0]* @0, i32 0, i32 %0, !dbg !6
28*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.value(metadata %0* %6, i64 0, metadata !7, metadata !{}), !dbg !12
29*9880d681SAndroid Build Coastguard Worker  %7 = icmp eq %0* %6, null, !dbg !13
30*9880d681SAndroid Build Coastguard Worker  br i1 %7, label %BB5, label %BB4, !dbg !13
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard WorkerBB4:                                              ; preds = %BB3
33*9880d681SAndroid Build Coastguard Worker  %8 = icmp slt i32 %0, 0, !dbg !5
34*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !14
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard WorkerBB5:                                              ; preds = %BB3, %BB2, %BB1, %Entry
37*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !14
38*9880d681SAndroid Build Coastguard Worker}
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!2}
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Worker!0 = distinct !DISubprogram(name: "foo", line: 231, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !2, file: !15, scope: !1, type: !3)
45*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "a.c", directory: "/private/tmp")
46*9880d681SAndroid Build Coastguard Worker!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang (trunk 129006)", isOptimized: true, emissionKind: FullDebug, file: !15, enums: !4, retainedTypes: !4)
47*9880d681SAndroid Build Coastguard Worker!3 = !DISubroutineType(types: !4)
48*9880d681SAndroid Build Coastguard Worker!4 = !{null}
49*9880d681SAndroid Build Coastguard Worker!5 = !DILocation(line: 131, column: 2, scope: !0)
50*9880d681SAndroid Build Coastguard Worker!6 = !DILocation(line: 134, column: 2, scope: !0)
51*9880d681SAndroid Build Coastguard Worker!7 = !DILocalVariable(name: "bar", line: 232, scope: !8, file: !1, type: !9)
52*9880d681SAndroid Build Coastguard Worker!8 = distinct !DILexicalBlock(line: 231, column: 1, file: !15, scope: !0)
53*9880d681SAndroid Build Coastguard Worker!9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, scope: !2, baseType: !10)
54*9880d681SAndroid Build Coastguard Worker!10 = !DIDerivedType(tag: DW_TAG_const_type, scope: !2, baseType: !11)
55*9880d681SAndroid Build Coastguard Worker!11 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
56*9880d681SAndroid Build Coastguard Worker!12 = !DILocation(line: 232, column: 40, scope: !8)
57*9880d681SAndroid Build Coastguard Worker!13 = !DILocation(line: 234, column: 2, scope: !8)
58*9880d681SAndroid Build Coastguard Worker!14 = !DILocation(line: 274, column: 1, scope: !8)
59*9880d681SAndroid Build Coastguard Worker!15 = !DIFile(filename: "a.c", directory: "/private/tmp")
60