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