llvm.org GIT mirror llvm / 97515eb
[Verifier] Check that debug values have proper size Summary: Teach the Verifier to make sure that the storage size given to llvm.dbg.declare or the value size given to llvm.dbg.value agree with what is declared in DebugInfo. This is implicitly assumed in a number of passes (e.g. in SROA). Additionally this catches a number of common mistakes, such as passing a pointer when a value was intended or vice versa. One complication comes from stack coloring which modifies the original IR when it merges allocas in order to make sure that if AA falls back to the IR it gets the correct result. However, given this new invariant, indiscriminately replacing one alloca by a different (differently sized one) is no longer valid. Fix this by just undefing out any use of the alloca in a dbg.declare in this case. Additionally, I had to fix a number of test cases. Of particular note: - I regenerated dbg-changes-codegen-branch-folding.ll from the given source as it was affected by the bug fixed in r256077 - two-cus-from-same-file.ll was changed to avoid having a variable-typed debug variable as that would depend on the target, even though this test is supposed to be generic - I had to manually declared size/align for reference type. See also the discussion for D14275/r253186. - fpstack-debuginstr-kill.ll required changing `double` to `long double` - most others were just a question of adding OP_deref Reviewers: aprantl Differential Revision: http://reviews.llvm.org/D14276 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257105 91177308-0d34-0410-b5e6-96231b3b80d8 Keno Fischer 4 years ago
27 changed file(s) with 249 addition(s) and 184 deletion(s). Raw diff Collapse all Expand all
2020 //
2121 //===----------------------------------------------------------------------===//
2222
23 #include "llvm/CodeGen/Passes.h"
2423 #include "llvm/ADT/BitVector.h"
2524 #include "llvm/ADT/DepthFirstIterator.h"
2625 #include "llvm/ADT/PostOrderIterator.h"
3938 #include "llvm/CodeGen/MachineMemOperand.h"
4039 #include "llvm/CodeGen/MachineModuleInfo.h"
4140 #include "llvm/CodeGen/MachineRegisterInfo.h"
41 #include "llvm/CodeGen/Passes.h"
4242 #include "llvm/CodeGen/PseudoSourceValue.h"
4343 #include "llvm/CodeGen/SlotIndexes.h"
4444 #include "llvm/CodeGen/StackProtector.h"
4646 #include "llvm/IR/Dominators.h"
4747 #include "llvm/IR/Function.h"
4848 #include "llvm/IR/Instructions.h"
49 #include "llvm/IR/IntrinsicInst.h"
4950 #include "llvm/IR/Module.h"
5051 #include "llvm/Support/CommandLine.h"
5152 #include "llvm/Support/Debug.h"
493494 // upcoming replacement.
494495 SP->adjustForColoring(From, To);
495496
497 // The new alloca might not be valid in a llvm.dbg.declare for this
498 // variable, so undef out the use to make the verifier happy.
499 AllocaInst *FromAI = const_cast(From);
500 if (FromAI->isUsedByMetadata())
501 ValueAsMetadata::handleRAUW(FromAI, UndefValue::get(FromAI->getType()));
502 for (auto &Use : FromAI->uses()) {
503 if (BitCastInst *BCI = dyn_cast(Use.get()))
504 if (BCI->isUsedByMetadata())
505 ValueAsMetadata::handleRAUW(BCI, UndefValue::get(BCI->getType()));
506 }
507
496508 // Note that this will not replace uses in MMOs (which we'll update below),
497509 // or anywhere else (which is why we won't delete the original
498510 // instruction).
499 const_cast(From)->replaceAllUsesWith(Inst);
511 FromAI->replaceAllUsesWith(Inst);
500512 }
501513
502514 // Remap all instructions to the new stack slots.
431431 // Module-level debug info verification...
432432 void verifyTypeRefs();
433433 template
434 void verifyBitPieceExpression(const DbgInfoIntrinsic &I,
435 const MapTy &TypeRefs);
434 void verifyDIExpression(const DbgInfoIntrinsic &I, const MapTy &TypeRefs);
436435 void visitUnresolvedTypeRef(const MDString *S, const MDNode *N);
437436 };
438437 } // End anonymous namespace
38533852 }
38543853
38553854 template
3856 void Verifier::verifyBitPieceExpression(const DbgInfoIntrinsic &I,
3857 const MapTy &TypeRefs) {
3855 void Verifier::verifyDIExpression(const DbgInfoIntrinsic &I,
3856 const MapTy &TypeRefs) {
38583857 DILocalVariable *V;
38593858 DIExpression *E;
3859 const Value *Arg;
3860 uint64_t ArgumentTypeSizeInBits = 0;
38603861 if (auto *DVI = dyn_cast(&I)) {
3862 Arg = DVI->getValue();
3863 if (Arg)
3864 ArgumentTypeSizeInBits =
3865 M->getDataLayout().getTypeAllocSizeInBits(Arg->getType());
38613866 V = dyn_cast_or_null(DVI->getRawVariable());
38623867 E = dyn_cast_or_null(DVI->getRawExpression());
38633868 } else {
38643869 auto *DDI = cast(&I);
3870 // For declare intrinsics, get the total size of the alloca, to allow
3871 // case where the variable may span more than one element.
3872 Arg = DDI->getAddress();
3873 if (Arg)
3874 Arg = Arg->stripPointerCasts();
3875 const AllocaInst *AI = dyn_cast_or_null(Arg);
3876 if (AI) {
3877 // We can only say something about constant size allocations
3878 if (const ConstantInt *CI = dyn_cast(AI->getArraySize()))
3879 ArgumentTypeSizeInBits =
3880 CI->getLimitedValue() *
3881 M->getDataLayout().getTypeAllocSizeInBits(AI->getAllocatedType());
3882 }
38653883 V = dyn_cast_or_null(DDI->getRawVariable());
38663884 E = dyn_cast_or_null(DDI->getRawExpression());
38673885 }
38683886
38693887 // We don't know whether this intrinsic verified correctly.
38703888 if (!V || !E || !E->isValid())
3871 return;
3872
3873 // Nothing to do if this isn't a bit piece expression.
3874 if (!E->isBitPiece())
38753889 return;
38763890
38773891 // The frontend helps out GDB by emitting the members of local anonymous
38893903 if (!VarSize)
38903904 return;
38913905
3892 unsigned PieceSize = E->getBitPieceSize();
3893 unsigned PieceOffset = E->getBitPieceOffset();
3894 Assert(PieceSize + PieceOffset <= VarSize,
3895 "piece is larger than or outside of variable", &I, V, E);
3896 Assert(PieceSize != VarSize, "piece covers entire variable", &I, V, E);
3906 if (E->isBitPiece()) {
3907 unsigned PieceSize = E->getBitPieceSize();
3908 unsigned PieceOffset = E->getBitPieceOffset();
3909 Assert(PieceSize + PieceOffset <= VarSize,
3910 "piece is larger than or outside of variable", &I, V, E);
3911 Assert(PieceSize != VarSize, "piece covers entire variable", &I, V, E);
3912 return;
3913 }
3914
3915 if (!ArgumentTypeSizeInBits)
3916 return; // We were unable to determine the size of the argument
3917
3918 if (E->getNumElements() == 0) {
3919 // In the case where the expression is empty, verify the size of the
3920 // argument. Doing this in the general case would require looking through
3921 // any dereferences that may be in the expression.
3922 Assert(ArgumentTypeSizeInBits == VarSize,
3923 "size of passed value (" + std::to_string(ArgumentTypeSizeInBits) +
3924 ") does not match size of declared variable (" +
3925 std::to_string(VarSize) + ")",
3926 &I, Arg, V, V->getType(), E);
3927 } else if (E->getElement(0) == dwarf::DW_OP_deref) {
3928 Assert(ArgumentTypeSizeInBits == M->getDataLayout().getPointerSizeInBits(),
3929 "the operation of the expression is a deref, but the passed value "
3930 "is not pointer sized",
3931 &I, Arg, V, V->getType(), E);
3932 }
38973933 }
38983934
38993935 void Verifier::visitUnresolvedTypeRef(const MDString *S, const MDNode *N) {
39263962 for (const BasicBlock &BB : F)
39273963 for (const Instruction &I : BB)
39283964 if (auto *DII = dyn_cast(&I))
3929 verifyBitPieceExpression(*DII, TypeRefs);
3965 verifyDIExpression(*DII, TypeRefs);
39303966
39313967 // Return early if all typerefs were resolved.
39323968 if (UnresolvedTypeRefs.empty())
0 ; RUN: llc -O0 -mtriple=arm-apple-darwin < %s | grep DW_OP_breg
11 ; Use DW_OP_breg in variable's location expression if the variable is in a stack slot.
2
3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64"
4 target triple = "arm-apple-darwin"
25
36 %struct.SVal = type { i8*, i32 }
47
7780 !llvm.module.flags = !{!49}
7881
7982 !0 = !DISubprogram(name: "SVal", line: 11, isLocal: false, isDefinition: false, virtualIndex: 6, isOptimized: false, file: !48, scope: !1, type: !14)
80 !1 = !DICompositeType(tag: DW_TAG_structure_type, name: "SVal", line: 1, size: 128, align: 64, file: !48, elements: !4)
83 !1 = !DICompositeType(tag: DW_TAG_structure_type, name: "SVal", line: 1, size: 64, align: 64, file: !48, elements: !4)
8184 !2 = !DIFile(filename: "small.cc", directory: "/Users/manav/R8248330")
8285 !3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: false, emissionKind: 1, file: !48, enums: !47, retainedTypes: !47, subprograms: !46, globals: !47, imports: !47)
8386 !4 = !{!5, !7, !0, !9}
102105 !23 = !DILocalVariable(name: "i", line: 16, arg: 1, scope: !17, file: !2, type: !13)
103106 !24 = !DILocation(line: 16, scope: !17)
104107 !25 = !DILocalVariable(name: "location", line: 16, arg: 2, scope: !17, file: !2, type: !26)
105 !26 = !DIDerivedType(tag: DW_TAG_reference_type, name: "SVal", size: 64, align: 64, file: !48, scope: !2, baseType: !1)
108 !26 = !DIDerivedType(tag: DW_TAG_reference_type, name: "SVal", size: 32, align: 32, file: !48, scope: !2, baseType: !1)
106109 !27 = !DILocation(line: 17, scope: !28)
107110 !28 = distinct !DILexicalBlock(line: 16, column: 0, file: !2, scope: !17)
108111 !29 = !DILocation(line: 18, scope: !28)
109112 !30 = !DILocation(line: 20, scope: !28)
110113 !31 = !DILocalVariable(name: "this", line: 11, arg: 1, scope: !16, file: !2, type: !32)
111 !32 = !DIDerivedType(tag: DW_TAG_const_type, size: 64, align: 64, flags: DIFlagArtificial, file: !48, scope: !2, baseType: !33)
112 !33 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !48, scope: !2, baseType: !1)
114 !32 = !DIDerivedType(tag: DW_TAG_const_type, flags: DIFlagArtificial, file: !48, scope: !2, baseType: !33)
115 !33 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, file: !48, scope: !2, baseType: !1)
113116 !34 = !DILocation(line: 11, scope: !16)
114117 !35 = !DILocation(line: 11, scope: !36)
115118 !36 = distinct !DILexicalBlock(line: 11, column: 0, file: !48, scope: !37)
55 entry:
66 %x.i = alloca i8, align 1
77 %y.i = alloca [256 x i8], align 16
8 %0 = bitcast [256 x i8]* %y.i to i8*
8 %0 = bitcast i8* %x.i to i8*
99 br label %for.body
1010
1111 for.body:
3434 !1 = !DIFile(filename: "t.c", directory: "")
3535 !2 = !{}
3636 !3 = !{i32 1, !"Debug Info Version", i32 3}
37 !4 = !DILocalVariable(name: "x", scope: !5, file: !1, line: 16, type: !6)
37 !4 = !DILocalVariable(name: "x", scope: !5, file: !1, line: 16, type: !9)
3838 !5 = distinct !DISubprogram(scope: null, isLocal: false, isDefinition: true, isOptimized: false)
3939 !6 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
4040 !7 = !DIExpression()
4141 !8 = !DILocation(line: 0, scope: !5)
42 !9 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 2048, align: 8, elements: !10)
43 !10 = !{!11}
44 !11 = !DISubrange(count: 256)
4245 ...
4346 ---
4447 name: foo
4952 # CHECK-LABEL: foo
5053 # CHECK: stack:
5154 # CHECK: - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4',
52 # CHECK-NEXT: di-expression: '!7', di-location: '!8' }
55 # CHECK-NEXT: di-expression: '!10', di-location: '!11' }
5356 stack:
5457 - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4',
5558 di-expression: '!7', di-location: '!8' }
3939 !1 = !{!2}
4040 !2 = distinct !DISubprogram(name: "test", isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 1, file: !6, scope: !5, type: !7)
4141 !3 = !DILocalVariable(name: "callback", line: 214, scope: !2, type: !4)
42 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "btCompoundLeafCallback", line: 90, size: 512, align: 64, file: !6)
42 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "btCompoundLeafCallback", line: 90, size: 64, align: 64, file: !6)
4343 !5 = !DIFile(filename: "MultiSource/Benchmarks/Bullet/btCompoundCollisionAlgorithm.cpp", directory: "MultiSource/Benchmarks/Bullet")
4444 !6 = !DIFile(filename: "MultiSource/Benchmarks/Bullet/btCompoundCollisionAlgorithm.cpp", directory: "MultiSource/Benchmarks/Bullet")
4545 !7 = !DISubroutineType(types: !9)
3535 !5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
3636 !6 = !DILocalVariable(name: "i", line: 2, arg: 1, scope: !1, file: !2, type: !5)
3737 !7 = !DILocalVariable(name: "c", line: 2, arg: 2, scope: !1, file: !2, type: !8)
38 !8 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, scope: !0, baseType: !9)
38 !8 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, scope: !0, baseType: !5)
3939 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
40 !10 = !DILocalVariable(name: "a", line: 3, scope: !11, file: !2, type: !9)
40 !10 = !DILocalVariable(name: "a", line: 3, scope: !11, file: !2, type: !5)
4141 !11 = distinct !DILexicalBlock(line: 2, column: 25, file: !20, scope: !1)
4242 !12 = !DILocation(line: 2, column: 13, scope: !1)
4343 !13 = !DILocation(line: 2, column: 22, scope: !1)
1111 ; CHECK: je .LBB0_4
1212
1313 ; Regenerate test with this command:
14 ; clang -emit-llvm -S -O2 -g
14 ; clang++ -emit-llvm -S -O2 -g
1515 ; from this source:
1616 ;
1717 ; extern void foo(char *dst,unsigned siz,const char *src);
4343 %struct.AAA3 = type { [4 x i8] }
4444
4545 @.str = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
46 @.str1 = private unnamed_addr constant [2 x i8] c"+\00", align 1
47 @.str2 = private unnamed_addr constant [2 x i8] c"-\00", align 1
46 @.str.1 = private unnamed_addr constant [2 x i8] c"+\00", align 1
47 @.str.2 = private unnamed_addr constant [2 x i8] c"-\00", align 1
4848
4949 ; Function Attrs: uwtable
5050 define void @_Z3barii(i32 %param1, i32 %param2) #0 !dbg !24 {
5151 entry:
5252 %var1 = alloca %struct.AAA3, align 1
5353 %var2 = alloca %struct.AAA3, align 1
54 tail call void @llvm.dbg.value(metadata i32 %param1, i64 0, metadata !30, metadata !DIExpression()), !dbg !47
55 tail call void @llvm.dbg.value(metadata i32 %param2, i64 0, metadata !31, metadata !DIExpression()), !dbg !47
56 tail call void @llvm.dbg.value(metadata i8* null, i64 0, metadata !32, metadata !DIExpression()), !dbg !49
54 tail call void @llvm.dbg.value(metadata i32 %param1, i64 0, metadata !29, metadata !46), !dbg !47
55 tail call void @llvm.dbg.value(metadata i32 %param2, i64 0, metadata !30, metadata !46), !dbg !48
56 tail call void @llvm.dbg.value(metadata i8* null, i64 0, metadata !31, metadata !46), !dbg !49
5757 %tobool = icmp eq i32 %param2, 0, !dbg !50
58 br i1 %tobool, label %if.end, label %if.then, !dbg !50
58 br i1 %tobool, label %if.end, label %if.then, !dbg !52
5959
6060 if.then: ; preds = %entry
61 %call = tail call i8* @_Z5i2stri(i32 %param2), !dbg !52
62 tail call void @llvm.dbg.value(metadata i8* %call, i64 0, metadata !32, metadata !DIExpression()), !dbg !49
63 br label %if.end, !dbg !54
61 %call = tail call i8* @_Z5i2stri(i32 %param2), !dbg !53
62 tail call void @llvm.dbg.value(metadata i8* %call, i64 0, metadata !31, metadata !46), !dbg !49
63 br label %if.end, !dbg !55
6464
6565 if.end: ; preds = %entry, %if.then
66 tail call void @llvm.dbg.value(metadata %struct.AAA3* %var1, i64 0, metadata !33, metadata !DIExpression()), !dbg !55
67 tail call void @llvm.dbg.value(metadata %struct.AAA3* %var1, i64 0, metadata !56, metadata !DIExpression()), !dbg !57
68 tail call void @llvm.dbg.value(metadata !58, i64 0, metadata !59, metadata !DIExpression()), !dbg !60
69 %arraydecay.i = getelementptr inbounds %struct.AAA3, %struct.AAA3* %var1, i64 0, i32 0, i64 0, !dbg !61
70 call void @_Z3fooPcjPKc(i8* %arraydecay.i, i32 4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)), !dbg !61
71 call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !34, metadata !DIExpression()), !dbg !63
72 call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !64, metadata !DIExpression()), !dbg !65
73 call void @llvm.dbg.value(metadata !58, i64 0, metadata !66, metadata !DIExpression()), !dbg !67
74 %arraydecay.i5 = getelementptr inbounds %struct.AAA3, %struct.AAA3* %var2, i64 0, i32 0, i64 0, !dbg !68
75 call void @_Z3fooPcjPKc(i8* %arraydecay.i5, i32 4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)), !dbg !68
76 %tobool1 = icmp eq i32 %param1, 0, !dbg !69
77 call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !34, metadata !DIExpression()), !dbg !63
78 br i1 %tobool1, label %if.else, label %if.then2, !dbg !69
66 %0 = getelementptr inbounds %struct.AAA3, %struct.AAA3* %var1, i64 0, i32 0, i64 0, !dbg !56
67 call void @llvm.lifetime.start(i64 4, i8* %0) #4, !dbg !56
68 tail call void @llvm.dbg.value(metadata %struct.AAA3* %var1, i64 0, metadata !32, metadata !57), !dbg !58
69 tail call void @llvm.dbg.value(metadata %struct.AAA3* %var1, i64 0, metadata !36, metadata !46), !dbg !59
70 tail call void @llvm.dbg.value(metadata i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i64 0, metadata !38, metadata !46), !dbg !62
71 call void @_Z3fooPcjPKc(i8* %0, i32 4, i8* nonnull getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)), !dbg !63
72 %1 = getelementptr inbounds %struct.AAA3, %struct.AAA3* %var2, i64 0, i32 0, i64 0, !dbg !65
73 call void @llvm.lifetime.start(i64 4, i8* %1) #4, !dbg !65
74 call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !33, metadata !57), !dbg !66
75 call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !36, metadata !46), !dbg !67
76 call void @llvm.dbg.value(metadata i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i64 0, metadata !38, metadata !46), !dbg !69
77 call void @_Z3fooPcjPKc(i8* %1, i32 4, i8* nonnull getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)), !dbg !70
78 %tobool1 = icmp eq i32 %param1, 0, !dbg !71
79 call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !33, metadata !57), !dbg !66
80 call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !41, metadata !46), !dbg !73
81 br i1 %tobool1, label %if.else, label %if.then2, !dbg !75
7982
8083 if.then2: ; preds = %if.end
81 call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !71, metadata !DIExpression()), !dbg !73
82 call void @llvm.dbg.value(metadata !74, i64 0, metadata !75, metadata !DIExpression()), !dbg !76
83 call void @_Z3fooPcjPKc(i8* %arraydecay.i5, i32 4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str1, i64 0, i64 0)), !dbg !76
84 br label %if.end3, !dbg !72
84 call void @llvm.dbg.value(metadata i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i64 0, metadata !42, metadata !46), !dbg !76
85 call void @_Z3fooPcjPKc(i8* %1, i32 4, i8* nonnull getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)), !dbg !78
86 br label %if.end3, !dbg !79
8587
8688 if.else: ; preds = %if.end
87 call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !77, metadata !DIExpression()), !dbg !79
88 call void @llvm.dbg.value(metadata !80, i64 0, metadata !81, metadata !DIExpression()), !dbg !82
89 call void @_Z3fooPcjPKc(i8* %arraydecay.i5, i32 4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str2, i64 0, i64 0)), !dbg !82
89 call void @llvm.dbg.value(metadata i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i64 0, metadata !42, metadata !46), !dbg !80
90 call void @_Z3fooPcjPKc(i8* %1, i32 4, i8* nonnull getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)), !dbg !81
9091 br label %if.end3
9192
9293 if.end3: ; preds = %if.else, %if.then2
93 call void @llvm.dbg.value(metadata %struct.AAA3* %var1, i64 0, metadata !33, metadata !DIExpression()), !dbg !55
94 call void @llvm.dbg.value(metadata %struct.AAA3* %var1, i64 0, metadata !83, metadata !DIExpression()), !dbg !85
95 call void @llvm.dbg.value(metadata !58, i64 0, metadata !86, metadata !DIExpression()), !dbg !87
96 call void @_Z3fooPcjPKc(i8* %arraydecay.i, i32 4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)), !dbg !87
97 ret void, !dbg !88
94 call void @llvm.dbg.value(metadata %struct.AAA3* %var1, i64 0, metadata !32, metadata !57), !dbg !58
95 call void @llvm.dbg.value(metadata %struct.AAA3* %var1, i64 0, metadata !41, metadata !46), !dbg !82
96 call void @llvm.dbg.value(metadata i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i64 0, metadata !42, metadata !46), !dbg !84
97 call void @_Z3fooPcjPKc(i8* %0, i32 4, i8* nonnull getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)), !dbg !85
98 call void @llvm.lifetime.end(i64 4, i8* %1) #4, !dbg !86
99 call void @llvm.lifetime.end(i64 4, i8* %0) #4, !dbg !87
100 ret void, !dbg !86
98101 }
99102
100 declare i8* @_Z5i2stri(i32) #1
101
102 declare void @_Z3fooPcjPKc(i8*, i32, i8*) #1
103 ; Function Attrs: argmemonly nounwind
104 declare void @llvm.lifetime.start(i64, i8* nocapture) #1
105
106 declare i8* @_Z5i2stri(i32) #2
107
108 ; Function Attrs: argmemonly nounwind
109 declare void @llvm.lifetime.end(i64, i8* nocapture) #1
110
111 declare void @_Z3fooPcjPKc(i8*, i32, i8*) #2
103112
104113 ; Function Attrs: nounwind readnone
105 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
106
107 attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
108 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
109 attributes #2 = { nounwind readnone }
114 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #3
115
116 attributes #0 = { uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
117 attributes #1 = { argmemonly nounwind }
118 attributes #2 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
119 attributes #3 = { nounwind readnone }
120 attributes #4 = { nounwind }
110121
111122 !llvm.dbg.cu = !{!0}
112 !llvm.module.flags = !{!44, !45}
113 !llvm.ident = !{!46}
114
115 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: true, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !23, globals: !2, imports: !2)
116 !1 = !DIFile(filename: "dbg-changes-codegen-branch-folding.cpp", directory: "/tmp/dbginfo")
123 !llvm.module.flags = !{!43, !44}
124 !llvm.ident = !{!45}
125
126 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 255993) (llvm/trunk 256074)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !23)
127 !1 = !DIFile(filename: "test.cpp", directory: "/mnt/extra")
117128 !2 = !{}
118129 !3 = !{!4}
119 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "AAA3", line: 4, size: 32, align: 8, file: !1, elements: !5, identifier: "_ZTS4AAA3")
130 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "AAA3", file: !1, line: 4, size: 32, align: 8, elements: !5, identifier: "_ZTS4AAA3")
120131 !5 = !{!6, !11, !17, !18}
121 !6 = !DIDerivedType(tag: DW_TAG_member, name: "text", line: 8, size: 32, align: 8, file: !1, scope: !"_ZTS4AAA3", baseType: !7)
122 !7 = !DICompositeType(tag: DW_TAG_array_type, size: 32, align: 8, baseType: !8, elements: !9)
123 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
132 !6 = !DIDerivedType(tag: DW_TAG_member, name: "text", scope: !"_ZTS4AAA3", file: !1, line: 8, baseType: !7, size: 32, align: 8)
133 !7 = !DICompositeType(tag: DW_TAG_array_type, baseType: !8, size: 32, align: 8, elements: !9)
134 !8 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
124135 !9 = !{!10}
125136 !10 = !DISubrange(count: 4)
126 !11 = !DISubprogram(name: "AAA3", line: 5, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 5, file: !1, scope: !"_ZTS4AAA3", type: !12)
137 !11 = !DISubprogram(name: "AAA3", scope: !"_ZTS4AAA3", file: !1, line: 5, type: !12, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true)
127138 !12 = !DISubroutineType(types: !13)
128139 !13 = !{null, !14, !15}
129 !14 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS4AAA3")
130 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !16)
140 !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS4AAA3", size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
141 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64, align: 64)
131142 !16 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !8)
132 !17 = !DISubprogram(name: "operator=", linkageName: "_ZN4AAA3aSEPKc", line: 6, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 6, file: !1, scope: !"_ZTS4AAA3", type: !12)
133 !18 = !DISubprogram(name: "operator const char *", linkageName: "_ZNK4AAA3cvPKcEv", line: 7, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 7, file: !1, scope: !"_ZTS4AAA3", type: !19)
143 !17 = !DISubprogram(name: "operator=", linkageName: "_ZN4AAA3aSEPKc", scope: !"_ZTS4AAA3", file: !1, line: 6, type: !12, isLocal: false, isDefinition: false, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true)
144 !18 = !DISubprogram(name: "operator const char *", linkageName: "_ZNK4AAA3cvPKcEv", scope: !"_ZTS4AAA3", file: !1, line: 7, type: !19, isLocal: false, isDefinition: false, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: true)
134145 !19 = !DISubroutineType(types: !20)
135146 !20 = !{!15, !21}
136 !21 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !22)
147 !21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !22, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
137148 !22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !"_ZTS4AAA3")
138 !23 = !{!24, !35, !40}
139 !24 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barii", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 11, file: !1, scope: !25, type: !26, variables: !29)
140 !25 = !DIFile(filename: "dbg-changes-codegen-branch-folding.cpp", directory: "/tmp/dbginfo")
141 !26 = !DISubroutineType(types: !27)
142 !27 = !{null, !28, !28}
143 !28 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
144 !29 = !{!30, !31, !32, !33, !34}
145 !30 = !DILocalVariable(name: "param1", line: 11, arg: 1, scope: !24, file: !25, type: !28)
146 !31 = !DILocalVariable(name: "param2", line: 11, arg: 2, scope: !24, file: !25, type: !28)
147 !32 = !DILocalVariable(name: "temp", line: 12, scope: !24, file: !25, type: !15)
148 !33 = !DILocalVariable(name: "var1", line: 17, scope: !24, file: !25, type: !"_ZTS4AAA3")
149 !34 = !DILocalVariable(name: "var2", line: 18, scope: !24, file: !25, type: !"_ZTS4AAA3")
150 !35 = distinct !DISubprogram(name: "operator=", linkageName: "_ZN4AAA3aSEPKc", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 6, file: !1, scope: !"_ZTS4AAA3", type: !12, declaration: !17, variables: !36)
151 !36 = !{!37, !39}
152 !37 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !35, type: !38)
153 !38 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS4AAA3")
154 !39 = !DILocalVariable(name: "value", line: 6, arg: 2, scope: !35, file: !25, type: !15)
155 !40 = distinct !DISubprogram(name: "AAA3", linkageName: "_ZN4AAA3C2EPKc", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 5, file: !1, scope: !"_ZTS4AAA3", type: !12, declaration: !11, variables: !41)
156 !41 = !{!42, !43}
157 !42 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !40, type: !38)
158 !43 = !DILocalVariable(name: "value", line: 5, arg: 2, scope: !40, file: !25, type: !15)
159 !44 = !{i32 2, !"Dwarf Version", i32 4}
160 !45 = !{i32 2, !"Debug Info Version", i32 3}
161 !46 = !{!"clang version 3.5.0 "}
162 !47 = !DILocation(line: 11, scope: !24)
163 !48 = !{i8* null}
164 !49 = !DILocation(line: 12, scope: !24)
165 !50 = !DILocation(line: 14, scope: !51)
166 !51 = distinct !DILexicalBlock(line: 14, column: 0, file: !1, scope: !24)
167 !52 = !DILocation(line: 15, scope: !53)
168 !53 = distinct !DILexicalBlock(line: 14, column: 0, file: !1, scope: !51)
169 !54 = !DILocation(line: 16, scope: !53)
170 !55 = !DILocation(line: 17, scope: !24)
171 !56 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !40, type: !38)
172 !57 = !DILocation(line: 0, scope: !40, inlinedAt: !55)
173 !58 = !{i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)}
174 !59 = !DILocalVariable(name: "value", line: 5, arg: 2, scope: !40, file: !25, type: !15)
175 !60 = !DILocation(line: 5, scope: !40, inlinedAt: !55)
176 !61 = !DILocation(line: 5, scope: !62, inlinedAt: !55)
177 !62 = distinct !DILexicalBlock(line: 5, column: 0, file: !1, scope: !40)
178 !63 = !DILocation(line: 18, scope: !24)
179 !64 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !40, type: !38)
180 !65 = !DILocation(line: 0, scope: !40, inlinedAt: !63)
181 !66 = !DILocalVariable(name: "value", line: 5, arg: 2, scope: !40, file: !25, type: !15)
182 !67 = !DILocation(line: 5, scope: !40, inlinedAt: !63)
183 !68 = !DILocation(line: 5, scope: !62, inlinedAt: !63)
184 !69 = !DILocation(line: 20, scope: !70)
185 !70 = distinct !DILexicalBlock(line: 20, column: 0, file: !1, scope: !24)
186 !71 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !35, type: !38)
187 !72 = !DILocation(line: 21, scope: !70)
188 !73 = !DILocation(line: 0, scope: !35, inlinedAt: !72)
189 !74 = !{i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str1, i64 0, i64 0)}
190 !75 = !DILocalVariable(name: "value", line: 6, arg: 2, scope: !35, file: !25, type: !15)
191 !76 = !DILocation(line: 6, scope: !35, inlinedAt: !72)
192 !77 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !35, type: !38)
193 !78 = !DILocation(line: 23, scope: !70)
194 !79 = !DILocation(line: 0, scope: !35, inlinedAt: !78)
195 !80 = !{i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str2, i64 0, i64 0)}
196 !81 = !DILocalVariable(name: "value", line: 6, arg: 2, scope: !35, file: !25, type: !15)
197 !82 = !DILocation(line: 6, scope: !35, inlinedAt: !78)
198 !83 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !35, type: !38)
199 !84 = !DILocation(line: 24, scope: !24)
200 !85 = !DILocation(line: 0, scope: !35, inlinedAt: !84)
201 !86 = !DILocalVariable(name: "value", line: 6, arg: 2, scope: !35, file: !25, type: !15)
202 !87 = !DILocation(line: 6, scope: !35, inlinedAt: !84)
203 !88 = !DILocation(line: 25, scope: !24)
149 !23 = !{!24, !34, !39}
150 !24 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barii", scope: !1, file: !1, line: 11, type: !25, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: true, variables: !28)
151 !25 = !DISubroutineType(types: !26)
152 !26 = !{null, !27, !27}
153 !27 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
154 !28 = !{!29, !30, !31, !32, !33}
155 !29 = !DILocalVariable(name: "param1", arg: 1, scope: !24, file: !1, line: 11, type: !27)
156 !30 = !DILocalVariable(name: "param2", arg: 2, scope: !24, file: !1, line: 11, type: !27)
157 !31 = !DILocalVariable(name: "temp", scope: !24, file: !1, line: 12, type: !15)
158 !32 = !DILocalVariable(name: "var1", scope: !24, file: !1, line: 17, type: !"_ZTS4AAA3")
159 !33 = !DILocalVariable(name: "var2", scope: !24, file: !1, line: 18, type: !"_ZTS4AAA3")
160 !34 = distinct !DISubprogram(name: "AAA3", linkageName: "_ZN4AAA3C2EPKc", scope: !"_ZTS4AAA3", file: !1, line: 5, type: !12, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, declaration: !11, variables: !35)
161 !35 = !{!36, !38}
162 !36 = !DILocalVariable(name: "this", arg: 1, scope: !34, type: !37, flags: DIFlagArtificial | DIFlagObjectPointer)
163 !37 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS4AAA3", size: 64, align: 64)
164 !38 = !DILocalVariable(name: "value", arg: 2, scope: !34, file: !1, line: 5, type: !15)
165 !39 = distinct !DISubprogram(name: "operator=", linkageName: "_ZN4AAA3aSEPKc", scope: !"_ZTS4AAA3", file: !1, line: 6, type: !12, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true, declaration: !17, variables: !40)
166 !40 = !{!41, !42}
167 !41 = !DILocalVariable(name: "this", arg: 1, scope: !39, type: !37, flags: DIFlagArtificial | DIFlagObjectPointer)
168 !42 = !DILocalVariable(name: "value", arg: 2, scope: !39, file: !1, line: 6, type: !15)
169 !43 = !{i32 2, !"Dwarf Version", i32 4}
170 !44 = !{i32 2, !"Debug Info Version", i32 3}
171 !45 = !{!"clang version 3.8.0 (trunk 255993) (llvm/trunk 256074)"}
172 !46 = !DIExpression()
173 !47 = !DILocation(line: 11, column: 15, scope: !24)
174 !48 = !DILocation(line: 11, column: 26, scope: !24)
175 !49 = !DILocation(line: 12, column: 16, scope: !24)
176 !50 = !DILocation(line: 14, column: 7, scope: !51)
177 !51 = distinct !DILexicalBlock(scope: !24, file: !1, line: 14, column: 7)
178 !52 = !DILocation(line: 14, column: 7, scope: !24)
179 !53 = !DILocation(line: 15, column: 12, scope: !54)
180 !54 = distinct !DILexicalBlock(scope: !51, file: !1, line: 14, column: 15)
181 !55 = !DILocation(line: 16, column: 3, scope: !54)
182 !56 = !DILocation(line: 17, column: 3, scope: !24)
183 !57 = !DIExpression(DW_OP_deref)
184 !58 = !DILocation(line: 17, column: 8, scope: !24)
185 !59 = !DILocation(line: 0, scope: !34, inlinedAt: !60)
186 !60 = distinct !DILocation(line: 17, column: 8, scope: !61)
187 !61 = !DILexicalBlockFile(scope: !24, file: !1, discriminator: 1)
188 !62 = !DILocation(line: 5, column: 19, scope: !34, inlinedAt: !60)
189 !63 = !DILocation(line: 5, column: 28, scope: !64, inlinedAt: !60)
190 !64 = distinct !DILexicalBlock(scope: !34, file: !1, line: 5, column: 26)
191 !65 = !DILocation(line: 18, column: 3, scope: !24)
192 !66 = !DILocation(line: 18, column: 8, scope: !24)
193 !67 = !DILocation(line: 0, scope: !34, inlinedAt: !68)
194 !68 = distinct !DILocation(line: 18, column: 8, scope: !61)
195 !69 = !DILocation(line: 5, column: 19, scope: !34, inlinedAt: !68)
196 !70 = !DILocation(line: 5, column: 28, scope: !64, inlinedAt: !68)
197 !71 = !DILocation(line: 20, column: 7, scope: !72)
198 !72 = distinct !DILexicalBlock(scope: !24, file: !1, line: 20, column: 7)
199 !73 = !DILocation(line: 0, scope: !39, inlinedAt: !74)
200 !74 = distinct !DILocation(line: 23, column: 10, scope: !72)
201 !75 = !DILocation(line: 20, column: 7, scope: !24)
202 !76 = !DILocation(line: 6, column: 29, scope: !39, inlinedAt: !77)
203 !77 = distinct !DILocation(line: 21, column: 10, scope: !72)
204 !78 = !DILocation(line: 6, column: 38, scope: !39, inlinedAt: !77)
205 !79 = !DILocation(line: 21, column: 5, scope: !72)
206 !80 = !DILocation(line: 6, column: 29, scope: !39, inlinedAt: !74)
207 !81 = !DILocation(line: 6, column: 38, scope: !39, inlinedAt: !74)
208 !82 = !DILocation(line: 0, scope: !39, inlinedAt: !83)
209 !83 = distinct !DILocation(line: 24, column: 8, scope: !24)
210 !84 = !DILocation(line: 6, column: 29, scope: !39, inlinedAt: !83)
211 !85 = !DILocation(line: 6, column: 38, scope: !39, inlinedAt: !83)
212 !86 = !DILocation(line: 25, column: 1, scope: !24)
213 !87 = !DILocation(line: 25, column: 1, scope: !61)
5959 !14 = !DIDerivedType(tag: DW_TAG_typedef, name: "fpu_extended", line: 3, file: !5, baseType: !15)
6060 !15 = !DIDerivedType(tag: DW_TAG_typedef, name: "fpu_register", line: 2, file: !5, baseType: !16)
6161 !16 = !DIDerivedType(tag: DW_TAG_typedef, name: "uae_f64", line: 1, file: !5, baseType: !17)
62 !17 = !DIBasicType(tag: DW_TAG_base_type, name: "double", size: 64, align: 64, encoding: DW_ATE_float)
62 !17 = !DIBasicType(tag: DW_TAG_base_type, name: "long double", size: 128, align: 128, encoding: DW_ATE_float)
6363 !18 = !DILocalVariable(name: "a", line: 15, scope: !4, file: !6, type: !19)
6464 !19 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
6565 !20 = !DILocalVariable(name: "value", line: 16, scope: !4, file: !6, type: !14)
4848 %0 = load i8, i8* @argc, align 1
4949 tail call void @llvm.dbg.value(metadata i8 %0, i64 0, metadata !19, metadata !29), !dbg !DILocation(scope: !13)
5050 %conv = sext i8 %0 to i32
51 tail call void @llvm.dbg.value(metadata %class.C* %c, i64 0, metadata !18, metadata !29), !dbg !DILocation(scope: !13)
51 tail call void @llvm.dbg.value(metadata %class.C* %c, i64 0, metadata !18, metadata !DIExpression(DW_OP_deref)), !dbg !DILocation(scope: !13)
5252 %call = call i32 (%class.C*, i8, i8, i8, ...) @test_function(%class.C* %c, i8 signext 0, i8 signext %0, i8 signext 0, i32 %conv)
5353 %1 = load i8, i8* @argc, align 1
54 call void @llvm.dbg.value(metadata %class.C* %c, i64 0, metadata !18, metadata !29), !dbg !DILocation(scope: !13)
54 call void @llvm.dbg.value(metadata %class.C* %c, i64 0, metadata !18, metadata !DIExpression(DW_OP_deref)), !dbg !DILocation(scope: !13)
5555 %call2 = call i32 (%class.C*, i8, i8, i8, ...) @test_function(%class.C* %c, i8 signext 0, i8 signext %1, i8 signext 0, i32 %conv)
5656 ret void
5757 }
238238 !76 = !DIExpression(DW_OP_bit_piece, 8, 120)
239239 !77 = !DILocation(line: 17, column: 12, scope: !31, inlinedAt: !75)
240240 !78 = !DIExpression(DW_OP_bit_piece, 136, 56)
241 !79 = !DIExpression()
241 !79 = !DIExpression(DW_OP_deref)
242242 !80 = !DILocation(line: 19, column: 5, scope: !34)
243243 !81 = !DILocation(line: 20, column: 7, scope: !34)
244244 !82 = !DILocation(line: 20, column: 5, scope: !34)
2222 %a10 = call i64 @llvm.bswap.i64(i64 %a9) nounwind ; [#uses=1]
2323 %a11 = getelementptr inbounds %struct.gpt_t, %struct.gpt_t* %gpt, i32 0, i32 8, !dbg !7 ; [#uses=1]
2424 %a12 = load i64, i64* %a11, align 4, !dbg !7 ; [#uses=1]
25 call void @llvm.dbg.declare(metadata i64* %data_addr.i17, metadata !8, metadata !DIExpression()) nounwind, !dbg !14
25 call void @llvm.dbg.declare(metadata i64* %data_addr.i17, metadata !8, metadata !DIExpression(DW_OP_deref)) nounwind, !dbg !14
2626 store i64 %a12, i64* %data_addr.i17, align 8
2727 call void @llvm.dbg.value(metadata !6, i64 0, metadata !15, metadata !DIExpression()) nounwind, !dbg !DILocation(scope: !16)
2828 call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !19, metadata !DIExpression()) nounwind, !dbg !DILocation(scope: !16)
2929 call void @llvm.dbg.declare(metadata !6, metadata !23, metadata !DIExpression()) nounwind, !dbg !DILocation(scope: !24)
30 call void @llvm.dbg.value(metadata i64* %data_addr.i17, i64 0, metadata !34, metadata !DIExpression()) nounwind, !dbg !DILocation(scope: !24)
30 call void @llvm.dbg.value(metadata i64* %data_addr.i17, i64 0, metadata !34, metadata !DIExpression(DW_OP_deref)) nounwind, !dbg !DILocation(scope: !24)
3131 %a13 = load volatile i64, i64* %data_addr.i17, align 8 ; [#uses=1]
3232 %a14 = call i64 @llvm.bswap.i64(i64 %a13) nounwind ; [#uses=2]
3333 %a15 = add i64 %a10, %a14, !dbg !7 ; [#uses=1]
3434 %call = tail call i32 @_Z4funcv(), !dbg !19
3535 tail call void @llvm.dbg.value(metadata i32 %call, i64 0, metadata !10, metadata !16), !dbg !17
3636 store volatile i32 %call, i32* %c, align 4, !dbg !19
37 tail call void @llvm.dbg.value(metadata i32* %c, i64 0, metadata !10, metadata !16), !dbg !17
37 tail call void @llvm.dbg.value(metadata i32* %c, i64 0, metadata !10, metadata !21), !dbg !17
3838 %c.0.c.0. = load volatile i32, i32* %c, align 4, !dbg !20
3939 ret i32 %c.0.c.0., !dbg !20
4040 }
7373 !18 = !DILocation(line: 5, column: 3, scope: !4)
7474 !19 = !DILocation(line: 6, column: 7, scope: !4)
7575 !20 = !DILocation(line: 7, column: 3, scope: !4)
76 !21 = !DIExpression(DW_OP_deref)
7677
2323 define i32 @main(i32 %argc, i8** nocapture %argv) nounwind !dbg !12 {
2424 entry:
2525 tail call void @llvm.dbg.value(metadata i32 %argc, i64 0, metadata !21, metadata !DIExpression()), !dbg !26
26 tail call void @llvm.dbg.value(metadata i8** %argv, i64 0, metadata !22, metadata !DIExpression()), !dbg !27
26 ; Avoid talking about the pointer size in debug info because that's target dependent
27 tail call void @llvm.dbg.value(metadata i8** %argv, i64 0, metadata !22, metadata !DIExpression(DW_OP_deref, DW_OP_deref)), !dbg !27
2728 %puts = tail call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str1, i32 0, i32 0)), !dbg !28
2829 tail call void @foo() nounwind, !dbg !30
2930 ret i32 0, !dbg !31
4546 !10 = !{!12}
4647 !12 = distinct !DISubprogram(name: "main", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 11, file: !32, scope: !6, type: !13, variables: !19)
4748 !13 = !DISubroutineType(types: !14)
48 !14 = !{!15, !15, !16}
49 !14 = !{!15, !15, !18}
4950 !15 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
50 !16 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, baseType: !17)
51 !17 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, baseType: !18)
5251 !18 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
5352 !19 = !{!21, !22}
5453 !21 = !DILocalVariable(name: "argc", line: 11, arg: 1, scope: !12, file: !6, type: !15)
55 !22 = !DILocalVariable(name: "argv", line: 11, arg: 2, scope: !12, file: !6, type: !16)
54 !22 = !DILocalVariable(name: "argv", line: 11, arg: 2, scope: !12, file: !6, type: !18)
5655 !23 = !DILocation(line: 6, column: 3, scope: !24)
5756 !24 = distinct !DILexicalBlock(line: 5, column: 16, file: !32, scope: !5)
5857 !25 = !DILocation(line: 7, column: 1, scope: !24)
6464 %1 = load i32, i32* %b.addr, align 4, !dbg !35
6565 %add = add nsw i32 %0, %1, !dbg !36
6666 store i32 %add, i32* %c, align 16, !dbg !33
67 call void @llvm.dbg.declare(metadata i32** %w, metadata !37, metadata !16), !dbg !38
67 call void @llvm.dbg.declare(metadata i32** %w, metadata !37, metadata !DIExpression(DW_OP_deref)), !dbg !38
6868 %2 = load i32, i32* %c, align 16, !dbg !39
6969 %3 = alloca i8, i32 %2, !dbg !40
7070 %4 = bitcast i8* %3 to i32*, !dbg !40
2929 call void @llvm.lifetime.start(i64 4, i8* %0) #4, !dbg !14
3030 tail call void @llvm.dbg.value(metadata i32 23, i64 0, metadata !9, metadata !15), !dbg !16
3131 store i32 23, i32* %x, align 4, !dbg !16, !tbaa !17
32 tail call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !9, metadata !15), !dbg !16
32 tail call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !9, metadata !DIExpression(DW_OP_deref)), !dbg !16
3333 call void @g(i32* nonnull %x) #4, !dbg !21
34 call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !9, metadata !15), !dbg !16
34 call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !9, metadata !DIExpression(DW_OP_deref)), !dbg !16
3535 %1 = load i32, i32* %x, align 4, !dbg !22, !tbaa !17
3636 %cmp = icmp eq i32 %1, 42, !dbg !24
3737 br i1 %cmp, label %if.then, label %if.end, !dbg !25
4343
4444 if.end: ; preds = %if.then, %entry
4545 %2 = phi i32 [ 43, %if.then ], [ %1, %entry ], !dbg !27
46 call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !9, metadata !15), !dbg !16
46 call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !9, metadata !DIExpression(DW_OP_deref)), !dbg !16
4747 call void @llvm.lifetime.end(i64 4, i8* %0) #4, !dbg !28
4848 ret i32 %2, !dbg !29
4949 }
0 ; RUN: llc < %s | FileCheck %s
1 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
2 target triple = "x86_64-apple-darwin10.0.0"
1 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32"
2 target triple = "i686-apple-darwin"
33 ; PR 9817
44
55
8585 !2 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "clc", isOptimized: false, emissionKind: 1, file: !20, enums: !21, retainedTypes: !21, subprograms: !19, imports: null)
8686 !3 = !DISubroutineType(types: !4)
8787 !4 = !{null, !5}
88 !5 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, scope: !2, baseType: !6)
88 !5 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align:64, scope: !2, baseType: !6)
8989 !6 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint", file: !20, scope: !2, baseType: !7)
9090 !7 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
9191 !8 = !DILocalVariable(name: "ip", line: 1, arg: 1, scope: !0, file: !1, type: !5)
66 ;
77 ; CHECK-LABEL: test:
88 ; CHECK: ##DEBUG_VALUE: foo:i
9
910 %a = type { i32, i32 }
1011
1112 define hidden fastcc %a* @test() #1 !dbg !1 {
8687 "44.i": ; preds = %"42.i"
8788 %2 = load %a*, %a** undef, align 8, !dbg !12
8889 %3 = bitcast %a* %2 to %a*, !dbg !12
89 call void @llvm.dbg.value(metadata %a* %3, i64 0, metadata !6, metadata !DIExpression()), !dbg !12
90 call void @llvm.dbg.value(metadata %a* %3, i64 0, metadata !6, metadata !DIExpression(DW_OP_deref)), !dbg !12
9091 br label %may_unswitch_on.exit, !dbg !12
9192
9293 "45.i": ; preds = %"38.i"
8080 !20 = !DISubprogram(name: "D", line: 4, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 4, file: !6, scope: !10, type: !21)
8181 !21 = !DISubroutineType(types: !22)
8282 !22 = !{null, !9, !23}
83 !23 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !24)
83 !23 = !DIDerivedType(tag: DW_TAG_reference_type, size: 64, align: 64, baseType: !24)
8484 !24 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !10)
8585 !27 = !{!29}
8686 !29 = !DILocalVariable(name: "this", line: 12, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !5, file: !6, type: !30)
5757 for.body: ; preds = %for.body, %entry
5858 %iter.02 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
5959 call void @llvm.lifetime.start(i64 4, i8* %0), !dbg !26
60 call void @llvm.dbg.value(metadata %struct.string* %str2.i, i64 0, metadata !16, metadata !DIExpression()) #3, !dbg !26
61 call void @llvm.dbg.value(metadata %struct.string* %str2.i, i64 0, metadata !27, metadata !DIExpression()) #3, !dbg !29
60 call void @llvm.dbg.value(metadata %struct.string* %str2.i, i64 0, metadata !16, metadata !DIExpression(DW_OP_deref)) #3, !dbg !26
61 call void @llvm.dbg.value(metadata %struct.string* %str2.i, i64 0, metadata !27, metadata !DIExpression(DW_OP_deref)) #3, !dbg !29
6262 call void @_Z4sinkPKv(i8* undef) #3, !dbg !29
6363 call void @_Z4sinkPKv(i8* %0) #3, !dbg !30
6464 call void @llvm.lifetime.end(i64 4, i8* %0), !dbg !31
8787
8888 while.body: ; preds = %entry, %while.cond.loopexit
8989 store i32 0, i32* %ref.tmp, align 4, !dbg !41, !tbaa !42
90 call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !21, metadata !36), !dbg !46
90 call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !21, metadata !DIExpression(DW_OP_deref)), !dbg !46
9191 call void @_Z4funcRKiS0_(i32* dereferenceable(4) %x, i32* dereferenceable(4) %ref.tmp), !dbg !47
9292 %call29 = call i32 @_Z4condv(), !dbg !48
9393 %tobool310 = icmp eq i32 %call29, 0, !dbg !48
9494 br i1 %tobool310, label %while.cond.loopexit, label %while.body4, !dbg !49
9595
9696 while.body4: ; preds = %while.body, %while.body4
97 call void @llvm.dbg.value(metadata i8* %y, i64 0, metadata !23, metadata !36), !dbg !50
97 call void @llvm.dbg.value(metadata i8* %y, i64 0, metadata !23, metadata !DIExpression(DW_OP_deref)), !dbg !50
9898 call void @_Z4funcPv(i8* %y), !dbg !51
99 call void @llvm.dbg.value(metadata i8* %j, i64 0, metadata !26, metadata !36), !dbg !52
99 call void @llvm.dbg.value(metadata i8* %j, i64 0, metadata !26, metadata !DIExpression(DW_OP_deref)), !dbg !52
100100 call void @_Z4funcPv(i8* %j), !dbg !53
101 call void @llvm.dbg.value(metadata i8* %I, i64 0, metadata !27, metadata !36), !dbg !54
101 call void @llvm.dbg.value(metadata i8* %I, i64 0, metadata !27, metadata !DIExpression(DW_OP_deref)), !dbg !54
102102 call void @_Z4funcPv(i8* %I), !dbg !55
103103 store i32 0, i32* %ref.tmp5, align 4, !dbg !56, !tbaa !42
104104 store i32 0, i32* %ref.tmp6, align 4, !dbg !57, !tbaa !42
105105 call void @_Z4funcRKiS0_(i32* dereferenceable(4) %ref.tmp5, i32* dereferenceable(4) %ref.tmp6), !dbg !58
106106 call void @llvm.dbg.declare(metadata %struct.A* undef, metadata !28, metadata !36), !dbg !59
107107 call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !28, metadata !33), !dbg !59
108 call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !21, metadata !36), !dbg !46
108 call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !21, metadata !DIExpression(DW_OP_deref)), !dbg !46
109109 call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !60, metadata !33), !dbg !62
110110 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !60, metadata !35), !dbg !62
111111 call void @llvm.dbg.declare(metadata %struct.A* undef, metadata !60, metadata !36), !dbg !62
2929 !6 = !DIFile(filename: "foo.cpp", directory: "/Users/echristo/tmp")
3030 !7 = !DISubroutineType(types: !8)
3131 !8 = !{null, !9}
32 !9 = !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: !10)
32 !9 = !DIDerivedType(tag: DW_TAG_rvalue_reference_type, size: 64, align: 64, baseType: !10)
3333 !10 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
3434 !11 = !DILocalVariable(name: "i", line: 4, arg: 1, scope: !5, file: !6, type: !9)
3535 !12 = !DILocation(line: 4, column: 17, scope: !5)
283283 !19 = !DISubprogram(name: "A", line: 5, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !1, scope: !"_ZTS1A", type: !20)
284284 !20 = !DISubroutineType(types: !21)
285285 !21 = !{null, !17, !22}
286 !22 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !23)
286 !22 = !DIDerivedType(tag: DW_TAG_reference_type, size: 64, align: 64, baseType: !23)
287287 !23 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !"_ZTS1A")
288288 !25 = !DISubprogram(name: "operator=", linkageName: "_ZN1AaSERKS_", line: 7, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !"_ZTS1A", type: !26)
289289 !26 = !DISubroutineType(types: !27)
112112 !10 = !{!"clang version 3.8.0 (trunk 254906) (llvm/trunk 254917)"}
113113 !11 = !DILocalVariable(name: "p", scope: !4, file: !1, line: 2, type: !12)
114114 !12 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
115 !13 = !DIExpression()
115 !13 = !DIExpression(DW_OP_deref)
116116 !14 = !DILocation(line: 2, column: 8, scope: !4)
117117 !15 = !DILocation(line: 3, column: 1, scope: !4)
117117
118118 ; Insert a meaningless dbg.value intrinsic; it should have no
119119 ; effect on the working of DSE in any way.
120 call void @llvm.dbg.value(metadata i32* undef, i64 0, metadata !10, metadata !DIExpression()), !dbg !DILocation(scope: !4)
120 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !10, metadata !DIExpression()), !dbg !DILocation(scope: !4)
121121
122122 ; CHECK: store i32 -1, i32* @x, align 4
123123 store i32 -1, i32* @x, align 4
2424 entry:
2525 tail call void @llvm.dbg.value(metadata double* %A, i64 0, metadata !12, metadata !DIExpression()), !dbg !19
2626 tail call void @llvm.dbg.value(metadata i32 %m, i64 0, metadata !13, metadata !DIExpression()), !dbg !19
27 tail call void @llvm.dbg.value(metadata i32 00, i64 0, metadata !14, metadata !DIExpression()), !dbg !21
28 tail call void @llvm.dbg.value(metadata i32 02, i64 0, metadata !15, metadata !DIExpression()), !dbg !21
27 tail call void @llvm.dbg.value(metadata double 0.0, i64 0, metadata !14, metadata !DIExpression()), !dbg !21
28 tail call void @llvm.dbg.value(metadata double 0.2, i64 0, metadata !15, metadata !DIExpression()), !dbg !21
2929 tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !16, metadata !DIExpression()), !dbg !23
3030 %cmp8 = icmp sgt i32 %m, 0, !dbg !23
3131 br i1 %cmp8, label %for.body.lr.ph, label %for.end, !dbg !23