1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 5
2 ; RUN: opt < %s -passes=loop-unroll -S | FileCheck %s
3 ; RUN: opt < %s -passes=loop-unroll-full -S | FileCheck %s
5 ;; Loop Unrolling should preserve the DebugLocs of conditional branches that get
6 ;; optimized into unconditional branches.
8 define i32 @_ZeqRK4int3S1_() {
9 ; CHECK-LABEL: define i32 @_ZeqRK4int3S1_() {
10 ; CHECK-NEXT: [[ENTRY:.*:]]
11 ; CHECK-NEXT: br label %[[FOR_BODY:.*]]
12 ; CHECK: [[FOR_COND:.*]]:
13 ; CHECK-NEXT: br label %[[CLEANUP:.*]], !dbg [[DBG3:![0-9]+]]
14 ; CHECK: [[FOR_BODY]]:
15 ; CHECK-NEXT: br i1 false, label %[[FOR_COND]], label %[[CLEANUP]]
17 ; CHECK-NEXT: ret i32 0
22 for.cond: ; preds = %for.body
23 br i1 false, label %cleanup, label %for.body, !dbg !3
25 for.body: ; preds = %for.cond, %entry
26 br i1 false, label %for.cond, label %cleanup
28 cleanup: ; preds = %for.body, %for.cond
33 !llvm.module.flags = !{!2}
35 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 20.0.0git", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug)
36 !1 = !DIFile(filename: "test.cpp", directory: "/tmp")
37 !2 = !{i32 2, !"Debug Info Version", i32 3}
38 !3 = !DILocation(line: 304, column: 2, scope: !4)
39 !4 = distinct !DILexicalBlock(scope: !5, file: !1, line: 304, column: 2)
40 !5 = distinct !DISubprogram(name: "operator==", linkageName: "_ZeqRK4int3S1_", scope: !1, file: !1, line: 302, type: !6, scopeLine: 303, spFlags: DISPFlagDefinition, unit: !0)
41 !6 = distinct !DISubroutineType(types: !7)
44 ; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: [[META1:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug)
45 ; CHECK: [[META1]] = !DIFile(filename: "test.cpp", directory: {{.*}})
46 ; CHECK: [[META2:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}
47 ; CHECK: [[DBG3]] = !DILocation(line: 304, column: 2, scope: [[META4:![0-9]+]])
48 ; CHECK: [[META4]] = distinct !DILexicalBlock(scope: [[META5:![0-9]+]], file: [[META1]], line: 304, column: 2)
49 ; CHECK: [[META5]] = distinct !DISubprogram(name: "operator==", linkageName: "_ZeqRK4int3S1_", scope: [[META1]], file: [[META1]], line: 302, type: [[META6:![0-9]+]], scopeLine: 303, spFlags: DISPFlagDefinition, unit: [[META0]])
50 ; CHECK: [[META6]] = distinct !DISubroutineType(types: [[META7:![0-9]+]])
51 ; CHECK: [[META7]] = !{}