phi-translate.ll 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ; RUN: opt -basicaa -gvn -S < %s | FileCheck %s
  2. target datalayout = "e-p:64:64:64"
  3. ; CHECK-LABEL: @foo(
  4. ; CHECK: entry.end_crit_edge:
  5. ; CHECK: %j.phi.trans.insert = sext i32 %x to i64, !dbg [[J_LOC:![0-9]+]]
  6. ; CHECK: %q.phi.trans.insert = getelementptr {{.*}}, !dbg [[Q_LOC:![0-9]+]]
  7. ; CHECK: %n.pre = load i32, i32* %q.phi.trans.insert, !dbg [[N_LOC:![0-9]+]]
  8. ; CHECK: then:
  9. ; CHECK: store i32 %z
  10. ; CHECK: end:
  11. ; CHECK: %n = phi i32 [ %n.pre, %entry.end_crit_edge ], [ %z, %then ], !dbg [[N_LOC]]
  12. ; CHECK: ret i32 %n
  13. ; CHECK-DAG: [[J_LOC]] = !DILocation(line: 45, column: 1, scope: !{{.*}})
  14. ; CHECK-DAG: [[Q_LOC]] = !DILocation(line: 46, column: 1, scope: !{{.*}})
  15. ; CHECK-DAG: [[N_LOC]] = !DILocation(line: 47, column: 1, scope: !{{.*}})
  16. @G = external global [100 x i32]
  17. define i32 @foo(i32 %x, i32 %z) {
  18. entry:
  19. %tobool = icmp eq i32 %z, 0, !dbg !7
  20. br i1 %tobool, label %end, label %then, !dbg !7
  21. then:
  22. %i = sext i32 %x to i64, !dbg !8
  23. %p = getelementptr [100 x i32], [100 x i32]* @G, i64 0, i64 %i, !dbg !8
  24. store i32 %z, i32* %p, !dbg !8
  25. br label %end, !dbg !8
  26. end:
  27. %j = sext i32 %x to i64, !dbg !9
  28. %q = getelementptr [100 x i32], [100 x i32]* @G, i64 0, i64 %j, !dbg !10
  29. %n = load i32, i32* %q, !dbg !11
  30. ret i32 %n, !dbg !11
  31. }
  32. !llvm.module.flags = !{!0, !1, !2}
  33. !0 = !{i32 2, !"Dwarf Version", i32 4}
  34. !1 = !{i32 2, !"Debug Info Version", i32 3}
  35. !2 = !{i32 1, !"PIC Level", i32 2}
  36. !3 = !{}
  37. !4 = !DISubroutineType(types: !3)
  38. !5 = !DIFile(filename: "a.cc", directory: "/tmp")
  39. !6 = !DISubprogram(name: "foo", scope: !5, file: !5, line: 42, type: !4, isLocal: false, isDefinition: true, scopeLine: 43, flags: DIFlagPrototyped, isOptimized: false, function: i32 (i32, i32)* @foo, variables: !3)
  40. !7 = !DILocation(line: 43, column: 1, scope: !6)
  41. !8 = !DILocation(line: 44, column: 1, scope: !6)
  42. !9 = !DILocation(line: 45, column: 1, scope: !6)
  43. !10 = !DILocation(line: 46, column: 1, scope: !6)
  44. !11 = !DILocation(line: 47, column: 1, scope: !6)