Avoid dbg.value use-before-def in a few tests (NFC)

This is preparation for landing a use-before-def verifier for debug
intrinsics (D46100).

As a drive-by, remove `tail` from debug intrinsic calls because it
doesn't mean anything in that context.

llvm-svn: 340366
This commit is contained in:
Vedant Kumar 2018-08-21 23:42:08 +00:00
parent ab6f84f763
commit a459b9f757
4 changed files with 13 additions and 13 deletions

View File

@ -25,11 +25,11 @@ target triple = "msp430"
; Function Attrs: nounwind readnone
define i64 @foo(i64 %a, i64 %b) local_unnamed_addr #0 !dbg !7 {
entry:
tail call void @llvm.dbg.value(metadata i64 %a, metadata !12, metadata !15), !dbg !16
tail call void @llvm.dbg.value(metadata i64 %b, metadata !13, metadata !15), !dbg !17
tail call void @llvm.dbg.value(metadata i64 %add, metadata !14, metadata !15), !dbg !18
call void @llvm.dbg.value(metadata i64 %a, metadata !12, metadata !15), !dbg !16
call void @llvm.dbg.value(metadata i64 %b, metadata !13, metadata !15), !dbg !17
%cmp = icmp eq i64 %a, %b, !dbg !19
%add = add nsw i64 %b, 1, !dbg !21
call void @llvm.dbg.value(metadata i64 %add, metadata !14, metadata !15), !dbg !18
%retval.0 = select i1 %cmp, i64 %add, i64 0, !dbg !22
ret i64 %retval.0, !dbg !23
}

View File

@ -109,15 +109,15 @@ define void @f(<{ %struct.NonTrivial, i32, i32, i32 }>* inalloca) local_unnamed_
entry:
%a = getelementptr inbounds <{ %struct.NonTrivial, i32, i32, i32 }>, <{ %struct.NonTrivial, i32, i32, i32 }>* %0, i32 0, i32 0
%b = getelementptr inbounds <{ %struct.NonTrivial, i32, i32, i32 }>, <{ %struct.NonTrivial, i32, i32, i32 }>* %0, i32 0, i32 1
tail call void @llvm.dbg.declare(metadata i32* %c, metadata !20, metadata !24), !dbg !25
tail call void @llvm.dbg.declare(metadata i32* %b, metadata !22, metadata !24), !dbg !26
tail call void @llvm.dbg.declare(metadata %struct.NonTrivial* %a, metadata !23, metadata !24), !dbg !27
call void @llvm.dbg.declare(metadata i32* %b, metadata !22, metadata !24), !dbg !26
call void @llvm.dbg.declare(metadata %struct.NonTrivial* %a, metadata !23, metadata !24), !dbg !27
%1 = load i32, i32* %b, align 4, !dbg !28, !tbaa !30
%tobool = icmp eq i32 %1, 0, !dbg !28
br i1 %tobool, label %if.else, label %if.then, !dbg !34
if.then: ; preds = %entry
%c = getelementptr inbounds <{ %struct.NonTrivial, i32, i32, i32 }>, <{ %struct.NonTrivial, i32, i32, i32 }>* %0, i32 0, i32 3
call void @llvm.dbg.declare(metadata i32* %c, metadata !20, metadata !24), !dbg !25
%2 = load i32, i32* %c, align 4, !dbg !35, !tbaa !30
tail call void @g(i32 %2) #4, !dbg !37
br label %if.end, !dbg !38

View File

@ -64,8 +64,8 @@ entry:
%6 = mul nuw i64 %5, %3, !dbg !40
%vla = alloca i32, i64 %6, align 16, !dbg !40
call void @llvm.dbg.declare(metadata i32* %vla, metadata !25, metadata !DIExpression()), !dbg !40
call void @llvm.dbg.declare(metadata i32* %vla4, metadata !13, metadata !DIExpression()), !dbg !40
%vla4 = alloca i32, i64 %6, align 16, !dbg !40
call void @llvm.dbg.declare(metadata i32* %vla4, metadata !13, metadata !DIExpression()), !dbg !40
call void @llvm.dbg.value(metadata i32 %i, metadata !29, metadata !DIExpression()), !dbg !40
call void @llvm.dbg.value(metadata i32 %j, metadata !31, metadata !DIExpression()), !dbg !40
call void @llvm.dbg.value(metadata i32 %k, metadata !33, metadata !DIExpression()), !dbg !40

View File

@ -19,10 +19,10 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
define i32 @f(i32* nocapture %a, i32 %size) #0 !dbg !4 {
entry:
tail call void @llvm.dbg.value(metadata i32* %a, metadata !13, metadata !DIExpression()), !dbg !19
tail call void @llvm.dbg.value(metadata i32 %size, metadata !14, metadata !DIExpression()), !dbg !19
tail call void @llvm.dbg.value(metadata i32 0, metadata !15, metadata !DIExpression()), !dbg !20
tail call void @llvm.dbg.value(metadata i32 0, metadata !16, metadata !DIExpression()), !dbg !21
call void @llvm.dbg.value(metadata i32* %a, metadata !13, metadata !DIExpression()), !dbg !19
call void @llvm.dbg.value(metadata i32 %size, metadata !14, metadata !DIExpression()), !dbg !19
call void @llvm.dbg.value(metadata i32 0, metadata !15, metadata !DIExpression()), !dbg !20
call void @llvm.dbg.value(metadata i32 0, metadata !16, metadata !DIExpression()), !dbg !21
%cmp4 = icmp eq i32 %size, 0, !dbg !21
br i1 %cmp4, label %for.end, label %for.body.lr.ph, !dbg !21
@ -35,15 +35,15 @@ for.body: ; preds = %for.body.lr.ph, %fo
%arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv, !dbg !22
%0 = load i32, i32* %arrayidx, align 4, !dbg !22
%add = add i32 %0, %sum.05, !dbg !22
tail call void @llvm.dbg.value(metadata i32 %add.lcssa, metadata !15, metadata !DIExpression()), !dbg !22
%indvars.iv.next = add i64 %indvars.iv, 1, !dbg !22
tail call void @llvm.dbg.value(metadata !{null}, metadata !16, metadata !DIExpression()), !dbg !22
call void @llvm.dbg.value(metadata !{null}, metadata !16, metadata !DIExpression()), !dbg !22
%lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !22
%exitcond = icmp ne i32 %lftr.wideiv, %size, !dbg !22
br i1 %exitcond, label %for.body, label %for.cond.for.end_crit_edge, !dbg !21
for.cond.for.end_crit_edge: ; preds = %for.body
%add.lcssa = phi i32 [ %add, %for.body ]
call void @llvm.dbg.value(metadata i32 %add.lcssa, metadata !15, metadata !DIExpression()), !dbg !22
br label %for.end, !dbg !21
for.end: ; preds = %entry, %for.cond.for.end_crit_edge