brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.3 KiB · 3ad956c Raw
92 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt %s -S -passes=simplifycfg -bonus-inst-threshold=2 | FileCheck %s3 4;;          +---------------+5;;          |               |6;;     +--> b --+           |7;;     |        v           v8;; --> a        d --> e --> f -->9;;     |        ^           ^10;;     +--> c --+           |11;;          |               |12;;          +---------------+13 14;; Block d gets folded into preds b and c. Check the cloned instructions get15;; remapped DILocation atomGroup numbers in each of the preds. Additionally16;; check that the branches each inherit the atomGroup of the folded branch.17 18declare i32 @g(...)19define void @f(i1 %c0, i1 %c1, i1 %c2, i32 %x, i32 %y) !dbg !17 {20; CHECK-LABEL: define void @f(21; CHECK-SAME: i1 [[C0:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]], i32 [[X:%.*]], i32 [[Y:%.*]]) !dbg [[DBG6:![0-9]+]] {22; CHECK-NEXT:  [[A:.*:]]23; CHECK-NEXT:    br i1 [[C0]], label %[[B:.*]], label %[[C:.*]]24; CHECK:       [[B]]:25; CHECK-NEXT:    [[AND_OLD:%.*]] = and i32 [[X]], [[Y]], !dbg [[DBG8:![0-9]+]]26; CHECK-NEXT:    [[CMP_OLD:%.*]] = icmp eq i32 [[AND_OLD]], 0, !dbg [[DBG9:![0-9]+]]27; CHECK-NEXT:    [[OR_COND1:%.*]] = select i1 [[C1]], i1 true, i1 [[CMP_OLD]], !dbg [[DBG10:![0-9]+]]28; CHECK-NEXT:    br i1 [[OR_COND1]], label %[[F:.*]], label %[[E:.*]], !dbg [[DBG11:![0-9]+]]29; CHECK:       [[C]]:30; CHECK-NEXT:    [[AND:%.*]] = and i32 [[X]], [[Y]], !dbg [[DBG12:![0-9]+]]31; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[AND]], 0, !dbg [[DBG13:![0-9]+]]32; CHECK-NEXT:    [[OR_COND:%.*]] = select i1 [[C2]], i1 true, i1 [[CMP]], !dbg [[DBG10]]33; CHECK-NEXT:    br i1 [[OR_COND]], label %[[F]], label %[[E]], !dbg [[DBG14:![0-9]+]]34; CHECK:       [[E]]:35; CHECK-NEXT:    [[TMP0:%.*]] = tail call i32 (...) @g()36; CHECK-NEXT:    br label %[[F]]37; CHECK:       [[F]]:38; CHECK-NEXT:    ret void39;40a:41  br i1 %c0, label %b, label %c42 43b:44  br i1 %c1, label %f, label %d, !dbg !1845 46c:47  br i1 %c2, label %f, label %d, !dbg !1848 49d:50  %and = and i32 %x, %y, !dbg !1951  %cmp = icmp eq i32 %and, 0, !dbg !2052  br i1 %cmp, label %f, label %e, !dbg !2153 54e:55  %7 = tail call i32 (...) @g()56  br label %f57 58f:59  ret void60}61 62!llvm.dbg.cu = !{!0}63!llvm.debugify = !{!3, !4}64!llvm.module.flags = !{!5}65 66!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)67!1 = !DIFile(filename: "a.ll", directory: "/")68!2 = !{}69!3 = !{i32 9}70!4 = !{i32 0}71!5 = !{i32 2, !"Debug Info Version", i32 3}72!7 = !DISubroutineType(types: !2)73!17 = distinct !DISubprogram(name: "f", scope: null, file: !1, line: 1, type: !7, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2, keyInstructions: true)74!18 = !DILocation(line: 10, column: 10, scope: !17)75!19 = !DILocation(line: 10, column: 10, scope: !17, atomGroup: 1, atomRank: 2)76!20 = !DILocation(line: 10, column: 10, scope: !17, atomGroup: 2, atomRank: 2)77!21 = !DILocation(line: 10, column: 10, scope: !17, atomGroup: 2, atomRank: 1)78;.79; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C, file: [[META1:![0-9]+]], producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: [[META2:![0-9]+]])80; CHECK: [[META1]] = !DIFile(filename: "a.ll", directory: {{.*}})81; CHECK: [[META2]] = !{}82; CHECK: [[DBG6]] = distinct !DISubprogram(name: "f", scope: null, file: [[META1]], line: 1, type: [[META7:![0-9]+]], scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META2]], keyInstructions: true)83; CHECK: [[META7]] = !DISubroutineType(types: [[META2]])84; CHECK: [[DBG8]] = !DILocation(line: 10, column: 10, scope: [[DBG6]], atomGroup: 5, atomRank: 2)85; CHECK: [[DBG9]] = !DILocation(line: 10, column: 10, scope: [[DBG6]], atomGroup: 6, atomRank: 2)86; CHECK: [[DBG10]] = !DILocation(line: 10, column: 10, scope: [[DBG6]])87; CHECK: [[DBG11]] = !DILocation(line: 10, column: 10, scope: [[DBG6]], atomGroup: 6, atomRank: 1)88; CHECK: [[DBG12]] = !DILocation(line: 10, column: 10, scope: [[DBG6]], atomGroup: 3, atomRank: 2)89; CHECK: [[DBG13]] = !DILocation(line: 10, column: 10, scope: [[DBG6]], atomGroup: 4, atomRank: 2)90; CHECK: [[DBG14]] = !DILocation(line: 10, column: 10, scope: [[DBG6]], atomGroup: 4, atomRank: 1)91;.92