brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 925a1df Raw
58 lines · plain
1; RUN: opt -S -strip-debug -aa-pipeline=globals-aa,basic-aa -passes='require<globals-aa>,instcombine' < %s | FileCheck %s2; RUN: opt -S -aa-pipeline=globals-aa,basic-aa -passes='require<globals-aa>,instcombine' < %s | FileCheck %s3 4; Having debug info around shouldn't affect what globals-aa and instcombine do.5 6@g = global i8 07 8define void @bar(i8 %p) {9   call void @llvm.dbg.value(metadata i64 0, metadata !14, metadata !DIExpression()), !dbg !1510  ret void11}12 13declare void @gaz(i8 %p)14 15define void @foo() {16  store i8 42, ptr @g, align 117  call void @bar(i8 1)18  %_tmp = load i8, ptr @g, align 119  call void @gaz(i8 %_tmp)20  ret void21}22 23; Function Attrs: nounwind readnone speculatable24declare void @llvm.dbg.value(metadata, metadata, metadata) #025 26attributes #0 = { nounwind readnone speculatable }27 28!llvm.dbg.cu = !{!5}29!llvm.module.flags = !{!8, !9}30!llvm.ident = !{!10}31 32!0 = !DIFile(filename: "foo.c", directory: "/tmp")33!1 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint64_t", file: !2, line: 77, baseType: !3)34!2 = !DIFile(filename: "foo.h", directory: "/tmp")35!3 = !DIDerivedType(tag: DW_TAG_typedef, name: "__u64_t", file: !0, baseType: !4)36!4 = !DIBasicType(name: "unsigned long long", size: 64, encoding: DW_ATE_unsigned)37!5 = distinct !DICompileUnit(language: DW_LANG_C, file: !0, producer: "My Compiler", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !6, retainedTypes: !6, globals: !7)38!6 = !{}39!7 = !{}40!8 = !{i32 2, !"Dwarf Version", i32 4}41!9 = !{i32 2, !"Debug Info Version", i32 3}42!10 = !{!"My Compiler"}43!11 = distinct !DISubprogram(name: "func_5", scope: !0, file: !0, line: 117, type: !12, isLocal: true, isDefinition: true, scopeLine: 118, isOptimized: false, unit: !5, retainedNodes: !6)44!12 = !DISubroutineType(types: !13)45!13 = !{}46!14 = !DILocalVariable(name: "p_6", arg: 1, scope: !11, line: 117, type: !1)47!15 = !DILocation(line: 117, column: 34, scope: !11)48 49; instcombine should realize that the load will read 42 from g and pass 42 to50; gaz regardless of the dbg.value in bar.51 52; CHECK: define void @foo() {53; CHECK-NEXT:  store i8 42, ptr @g, align 154; CHECK-NEXT:  call void @bar(i8 1)55; CHECK-NEXT:  call void @gaz(i8 42)56; CHECK-NEXT:  ret void57 58