brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · affeb46 Raw
75 lines · plain
1; RUN: opt -passes=instcombine -S < %s | FileCheck %s2;3; Generated with:4;5; clang -S -gmlt -emit-llvm test.c -o 1.ll6; opt -passes=sroa -S 1.ll -o test.ll7;8; extern int bar(int i);9; extern int bar2(int i);10;11; int foo(int a, int *d) {12;   if(a) {13;       *d = bar(a);14;   } else {15;       *d = bar2(a);16;   }17;18;   return a;19; }20;21; CHECK:       define {{.*}}@foo22; CHECK:       if.end:23; CHECK-NEXT:  %storemerge = phi24;25; The debug location on the store should be a line-0 location.26; CHECK-NEXT:  store i32 %storemerge{{.*}}, align 4, !dbg [[storeLoc:![0-9]+]]27; CHECK: [[storeLoc]] = !DILocation(line: 028;29; ModuleID = 'test1.ll'30source_filename = "test.c"31target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"32target triple = "x86_64-unknown-linux-gnu"33 34; Function Attrs: noinline nounwind uwtable35define i32 @foo(i32 %a, ptr %d) !dbg !6 {36entry:37  %tobool = icmp ne i32 %a, 0, !dbg !838  br i1 %tobool, label %if.then, label %if.else, !dbg !839 40if.then:                                          ; preds = %entry41  %call = call i32 @bar(i32 %a), !dbg !942  store i32 %call, ptr %d, align 4, !dbg !1043  br label %if.end, !dbg !1144 45if.else:                                          ; preds = %entry46  %call1 = call i32 @bar2(i32 %a), !dbg !1247  store i32 %call1, ptr %d, align 4, !dbg !1348  br label %if.end49 50if.end:                                           ; preds = %if.else, %if.then51  ret i32 %a, !dbg !1452}53 54declare i32 @bar(i32)55 56declare i32 @bar2(i32)57 58!llvm.dbg.cu = !{!0}59!llvm.module.flags = !{!3, !4}60 61!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)62!1 = !DIFile(filename: "test.c", directory: "/home/probinson/projects/scratch")63!2 = !{}64!3 = !{i32 2, !"Dwarf Version", i32 4}65!4 = !{i32 2, !"Debug Info Version", i32 3}66!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, type: !7, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)67!7 = !DISubroutineType(types: !2)68!8 = !DILocation(line: 5, column: 6, scope: !6)69!9 = !DILocation(line: 6, column: 12, scope: !6)70!10 = !DILocation(line: 6, column: 10, scope: !6)71!11 = !DILocation(line: 7, column: 3, scope: !6)72!12 = !DILocation(line: 8, column: 12, scope: !6)73!13 = !DILocation(line: 8, column: 10, scope: !6)74!14 = !DILocation(line: 10, column: 3, scope: !6)75