branch-fold-dbg.ll 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ; RUN: opt -simplifycfg -S < %s | FileCheck %s
  2. %0 = type { i32*, i32* }
  3. @0 = external hidden constant [5 x %0], align 4
  4. define void @foo(i32) nounwind ssp {
  5. Entry:
  6. %1 = icmp slt i32 %0, 0, !dbg !5
  7. br i1 %1, label %BB5, label %BB1, !dbg !5
  8. BB1: ; preds = %Entry
  9. %2 = icmp sgt i32 %0, 4, !dbg !5
  10. br i1 %2, label %BB5, label %BB2, !dbg !5
  11. BB2: ; preds = %BB1
  12. %3 = shl i32 1, %0, !dbg !5
  13. %4 = and i32 %3, 31, !dbg !5
  14. %5 = icmp eq i32 %4, 0, !dbg !5
  15. br i1 %5, label %BB5, label %BB3, !dbg !5
  16. ;CHECK: icmp eq
  17. ;CHECK-NEXT: getelementptr
  18. ;CHECK-NEXT: icmp eq
  19. BB3: ; preds = %BB2
  20. %6 = getelementptr inbounds [5 x %0], [5 x %0]* @0, i32 0, i32 %0, !dbg !6
  21. call void @llvm.dbg.value(metadata %0* %6, i64 0, metadata !7, metadata !{}), !dbg !12
  22. %7 = icmp eq %0* %6, null, !dbg !13
  23. br i1 %7, label %BB5, label %BB4, !dbg !13
  24. BB4: ; preds = %BB3
  25. %8 = icmp slt i32 %0, 0, !dbg !5
  26. ret void, !dbg !14
  27. BB5: ; preds = %BB3, %BB2, %BB1, %Entry
  28. ret void, !dbg !14
  29. }
  30. declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
  31. !llvm.dbg.sp = !{!0}
  32. !0 = !DISubprogram(name: "foo", line: 231, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !15, scope: !1, type: !3, function: void (i32)* @foo)
  33. !1 = !DIFile(filename: "a.c", directory: "/private/tmp")
  34. !2 = !DICompileUnit(language: DW_LANG_C99, producer: "clang (trunk 129006)", isOptimized: true, emissionKind: 0, file: !15, enums: !4, retainedTypes: !4)
  35. !3 = !DISubroutineType(types: !4)
  36. !4 = !{null}
  37. !5 = !DILocation(line: 131, column: 2, scope: !0)
  38. !6 = !DILocation(line: 134, column: 2, scope: !0)
  39. !7 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "bar", line: 232, scope: !8, file: !1, type: !9)
  40. !8 = distinct !DILexicalBlock(line: 231, column: 1, file: !15, scope: !0)
  41. !9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, scope: !2, baseType: !10)
  42. !10 = !DIDerivedType(tag: DW_TAG_const_type, scope: !2, baseType: !11)
  43. !11 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
  44. !12 = !DILocation(line: 232, column: 40, scope: !8)
  45. !13 = !DILocation(line: 234, column: 2, scope: !8)
  46. !14 = !DILocation(line: 274, column: 1, scope: !8)
  47. !15 = !DIFile(filename: "a.c", directory: "/private/tmp")