2013-05-24 01:02:23 +08:00
|
|
|
; RUN: llc < %s -verify-machineinstrs
|
|
|
|
; PR16110
|
|
|
|
;
|
|
|
|
; This test case contains a value that is split into two connected components
|
|
|
|
; by rematerialization during coalescing. It also contains a DBG_VALUE
|
|
|
|
; instruction which must be updated during
|
|
|
|
; ConnectedVNInfoEqClasses::Distribute().
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
source_filename = "test/CodeGen/ARM/coalesce-dbgvalue.ll"
|
2013-05-24 01:02:23 +08:00
|
|
|
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
|
|
|
|
target triple = "thumbv7-apple-ios3.0.0"
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
@c = common global i32 0, align 4, !dbg !0
|
|
|
|
@b = common global i32 0, align 4, !dbg !4
|
|
|
|
@a = common global i64 0, align 8, !dbg !6
|
|
|
|
@d = common global i32 0, align 4, !dbg !9
|
2013-05-24 01:02:23 +08:00
|
|
|
|
|
|
|
; Function Attrs: nounwind ssp
|
2016-12-22 08:45:21 +08:00
|
|
|
define i32 @pr16110() #0 !dbg !15 {
|
2013-05-24 01:02:23 +08:00
|
|
|
for.cond1.preheader:
|
2016-12-22 08:45:21 +08:00
|
|
|
store i32 0, i32* @c, align 4, !dbg !24
|
2013-05-24 01:02:23 +08:00
|
|
|
br label %for.cond1.outer, !dbg !26
|
|
|
|
|
|
|
|
for.cond1: ; preds = %for.end9, %for.cond1.outer
|
|
|
|
%storemerge11 = phi i32 [ 0, %for.end9 ], [ %storemerge11.ph, %for.cond1.outer ]
|
|
|
|
%cmp = icmp slt i32 %storemerge11, 1, !dbg !26
|
|
|
|
br i1 %cmp, label %for.body2, label %for.end9, !dbg !26
|
|
|
|
|
|
|
|
for.body2: ; preds = %for.cond1
|
2013-10-01 02:17:35 +08:00
|
|
|
store i32 %storemerge11, i32* @b, align 4, !dbg !26
|
2016-12-22 08:45:21 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32* null, i64 0, metadata !20, metadata !27), !dbg !28
|
2015-02-28 05:17:42 +08:00
|
|
|
%0 = load i64, i64* @a, align 8, !dbg !29
|
2013-05-24 01:02:23 +08:00
|
|
|
%xor = xor i64 %0, %e.1.ph, !dbg !29
|
|
|
|
%conv3 = trunc i64 %xor to i32, !dbg !29
|
2016-12-22 08:45:21 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %conv3, i64 0, metadata !19, metadata !27), !dbg !29
|
2013-05-24 01:02:23 +08:00
|
|
|
%tobool4 = icmp eq i32 %conv3, 0, !dbg !29
|
|
|
|
br i1 %tobool4, label %land.end, label %land.rhs, !dbg !29
|
|
|
|
|
|
|
|
land.rhs: ; preds = %for.body2
|
|
|
|
%call = tail call i32 bitcast (i32 (...)* @fn3 to i32 ()*)() #3, !dbg !29
|
|
|
|
%tobool5 = icmp ne i32 %call, 0, !dbg !29
|
|
|
|
br label %land.end
|
|
|
|
|
|
|
|
land.end: ; preds = %land.rhs, %for.body2
|
|
|
|
%1 = phi i1 [ false, %for.body2 ], [ %tobool5, %land.rhs ]
|
|
|
|
%land.ext = zext i1 %1 to i32
|
|
|
|
%call6 = tail call i32 bitcast (i32 (...)* @fn2 to i32 (i32, i32*)*)(i32 %land.ext, i32* null) #3
|
2015-02-28 05:17:42 +08:00
|
|
|
%2 = load i32, i32* @b, align 4, !dbg !26
|
2013-05-24 01:02:23 +08:00
|
|
|
%inc8 = add nsw i32 %2, 1, !dbg !26
|
|
|
|
%phitmp = and i64 %xor, 4294967295, !dbg !26
|
|
|
|
br label %for.cond1.outer, !dbg !26
|
|
|
|
|
|
|
|
for.cond1.outer: ; preds = %land.end, %for.cond1.preheader
|
|
|
|
%storemerge11.ph = phi i32 [ %inc8, %land.end ], [ 0, %for.cond1.preheader ]
|
|
|
|
%e.1.ph = phi i64 [ %phitmp, %land.end ], [ 0, %for.cond1.preheader ]
|
2016-12-22 08:45:21 +08:00
|
|
|
%3 = load i32, i32* @d, align 4, !dbg !30
|
|
|
|
%tobool10 = icmp eq i32 %3, 0, !dbg !30
|
2013-05-24 01:02:23 +08:00
|
|
|
br label %for.cond1
|
|
|
|
|
|
|
|
for.end9: ; preds = %for.cond1
|
2016-12-22 08:45:21 +08:00
|
|
|
br i1 %tobool10, label %if.end, label %for.cond1, !dbg !30
|
2013-05-24 01:02:23 +08:00
|
|
|
|
|
|
|
if.end: ; preds = %for.end9
|
2013-10-01 02:17:35 +08:00
|
|
|
store i32 %storemerge11, i32* @b, align 4, !dbg !26
|
2016-12-22 08:45:21 +08:00
|
|
|
ret i32 0, !dbg !31
|
2013-05-24 01:02:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @fn2(...) #1
|
|
|
|
|
|
|
|
declare i32 @fn3(...) #1
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
llvm-svn: 218787
2014-10-02 02:55:02 +08:00
|
|
|
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
|
2013-05-24 01:02:23 +08:00
|
|
|
|
2013-08-23 05:28:54 +08:00
|
|
|
attributes #0 = { nounwind ssp "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
|
|
attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
2013-05-24 01:02:23 +08:00
|
|
|
attributes #2 = { nounwind readnone }
|
|
|
|
attributes #3 = { nounwind }
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
!llvm.dbg.cu = !{!11}
|
|
|
|
!llvm.module.flags = !{!14}
|
|
|
|
|
|
|
|
!0 = !DIGlobalVariableExpression(var: !1)
|
|
|
|
!1 = !DIGlobalVariable(name: "c", scope: null, file: !2, line: 3, type: !3, isLocal: false, isDefinition: true)
|
|
|
|
!2 = !DIFile(filename: "pr16110.c", directory: "/d/b")
|
|
|
|
!3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
|
|
|
!4 = !DIGlobalVariableExpression(var: !5)
|
|
|
|
!5 = !DIGlobalVariable(name: "b", scope: null, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true)
|
|
|
|
!6 = !DIGlobalVariableExpression(var: !7)
|
|
|
|
!7 = !DIGlobalVariable(name: "a", scope: null, file: !2, line: 1, type: !8, isLocal: false, isDefinition: true)
|
|
|
|
!8 = !DIBasicType(name: "long long int", size: 64, align: 32, encoding: DW_ATE_signed)
|
|
|
|
!9 = !DIGlobalVariableExpression(var: !10)
|
|
|
|
!10 = !DIGlobalVariable(name: "d", scope: null, file: !2, line: 4, type: !3, isLocal: false, isDefinition: true)
|
|
|
|
!11 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 3.4 (trunk 182024) (llvm/trunk 182023)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !12, retainedTypes: !12, globals: !13, imports: !12)
|
|
|
|
!12 = !{}
|
|
|
|
!13 = !{!6, !4, !0, !9}
|
|
|
|
!14 = !{i32 1, !"Debug Info Version", i32 3}
|
|
|
|
!15 = distinct !DISubprogram(name: "pr16110", scope: !2, file: !2, line: 7, type: !16, isLocal: false, isDefinition: true, scopeLine: 7, virtualIndex: 6, isOptimized: true, unit: !11, variables: !18)
|
|
|
|
!16 = !DISubroutineType(types: !17)
|
|
|
|
!17 = !{!3}
|
|
|
|
!18 = !{!19, !20}
|
|
|
|
!19 = !DILocalVariable(name: "e", scope: !15, file: !2, line: 8, type: !3)
|
|
|
|
!20 = !DILocalVariable(name: "f", scope: !21, file: !2, line: 13, type: !23)
|
|
|
|
!21 = distinct !DILexicalBlock(scope: !22, file: !2, line: 12)
|
|
|
|
!22 = distinct !DILexicalBlock(scope: !15, file: !2, line: 12)
|
|
|
|
!23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !3, size: 32, align: 32)
|
|
|
|
!24 = !DILocation(line: 10, scope: !25)
|
|
|
|
!25 = distinct !DILexicalBlock(scope: !15, file: !2, line: 10)
|
|
|
|
!26 = !DILocation(line: 12, scope: !22)
|
|
|
|
!27 = !DIExpression()
|
|
|
|
!28 = !DILocation(line: 13, scope: !21)
|
|
|
|
!29 = !DILocation(line: 14, scope: !21)
|
|
|
|
!30 = !DILocation(line: 16, scope: !15)
|
|
|
|
!31 = !DILocation(line: 18, scope: !15)
|
|
|
|
|