[PATCH] D42541: [DeadArgumentElimination] Preserve llvm.dbg.values's first argument
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 25 10:21:16 PST 2018
aprantl added a comment.
Thanks. Here is the before/after of the testcase in case anyone else is wondering:
--- /tmp/t.ll 2018-01-25 10:17:20.000000000 -0800
+++ /tmp/2.ll 2018-01-25 10:17:40.000000000 -0800
@@ -1,80 +1,79 @@
-; RUN: opt -deadargelim -S < %s | FileCheck %s
+; ModuleID = '/tmp/t.ll'
+source_filename = "/tmp/t.ll"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
%struct.Channel = type { i32, i32 }
-; Function Attrs: nounwind uwtable
-define void @f2(i32 %m, i32 %n) #0 !dbg !7 {
+define void @f2(i32 %m, i32 %n) !dbg !7 {
entry:
call void @llvm.dbg.value(metadata i32 %m, metadata !12, metadata !DIExpression()), !dbg !21
call void @llvm.dbg.value(metadata i32 %n, metadata !13, metadata !DIExpression()), !dbg !22
call void @llvm.dbg.value(metadata %struct.Channel* null, metadata !14, metadata !DIExpression()), !dbg !23
%call = call %struct.Channel* (...) @foo(), !dbg !24
call void @llvm.dbg.value(metadata %struct.Channel* %call, metadata !14, metadata !DIExpression()), !dbg !23
%cmp = icmp sgt i32 %m, 3, !dbg !25
br i1 %cmp, label %if.then, label %if.end, !dbg !27
if.then: ; preds = %entry
- %call1 = call zeroext i1 @f1(i1 zeroext true, %struct.Channel* %call), !dbg !28
+ call void @f1(i1 zeroext true, %struct.Channel* %call), !dbg !28
br label %if.end, !dbg !28
if.end: ; preds = %if.then, %entry
%cmp2 = icmp sgt i32 %n, %m, !dbg !29
br i1 %cmp2, label %if.then3, label %if.end5, !dbg !31
if.then3: ; preds = %if.end
- %call4 = call zeroext i1 @f1(i1 zeroext false, %struct.Channel* %call), !dbg !32
+ call void @f1(i1 zeroext false, %struct.Channel* %call), !dbg !32
br label %if.end5, !dbg !32
if.end5: ; preds = %if.then3, %if.end
ret void, !dbg !33
}
-declare %struct.Channel* @foo(...) local_unnamed_addr #1
+declare %struct.Channel* @foo(...) local_unnamed_addr
-; Function Attrs: noinline nounwind uwtable
-define internal zeroext i1 @f1(i1 zeroext %is_y, %struct.Channel* %str) #4 !dbg !34 {
+define internal void @f1(i1 zeroext %is_y, %struct.Channel* %str) !dbg !34 {
entry:
%frombool = zext i1 %is_y to i8
-; CHECK: call void @llvm.dbg.value(metadata i1 %is_y, metadata !39, metadata !DIExpression()), !dbg !42
- call void @llvm.dbg.value(metadata i1 %is_y, metadata !39, metadata !DIExpression()), !dbg !42
-; CHECK: call void @llvm.dbg.value(metadata %struct.Channel* %str, metadata !40, metadata !DIExpression()), !dbg !43
- call void @llvm.dbg.value(metadata %struct.Channel* %str, metadata !40, metadata !DIExpression()), !dbg !43
+ call void @llvm.dbg.value(metadata !2, metadata !39, metadata !DIExpression()), !dbg !42
+ call void @llvm.dbg.value(metadata !2, metadata !40, metadata !DIExpression()), !dbg !43
call void @llvm.dbg.value(metadata %struct.Channel* null, metadata !41, metadata !DIExpression()), !dbg !44
%tobool = icmp ne %struct.Channel* %str, null, !dbg !45
br i1 %tobool, label %if.end, label %if.then, !dbg !47
if.then: ; preds = %entry
call void (...) @baa(), !dbg !48
br label %cleanup, !dbg !50
if.end: ; preds = %entry
%call = call %struct.Channel* (...) @foo(), !dbg !51
call void @llvm.dbg.value(metadata %struct.Channel* %call, metadata !41, metadata !DIExpression()), !dbg !44
%tobool1 = trunc i8 %frombool to i1, !dbg !52
- br i1 %tobool1, label %if.then2, label %if.end3, !dbg !56
+ br i1 %tobool1, label %if.then2, label %if.end3, !dbg !53
if.then2: ; preds = %if.end
- call void (...) @baa(), !dbg !57
- br label %cleanup, !dbg !56
+ call void (...) @baa(), !dbg !56
+ br label %cleanup, !dbg !53
if.end3: ; preds = %if.end
- br label %cleanup, !dbg !56
+ br label %cleanup, !dbg !53
cleanup: ; preds = %if.end3, %if.then2, %if.then
%retval.0 = phi i1 [ false, %if.then2 ], [ true, %if.end3 ], [ false, %if.then ]
- ret i1 %retval.0, !dbg !56
+ ret void
}
-declare void @baa(...) local_unnamed_addr #1
+declare void @baa(...) local_unnamed_addr
; Function Attrs: nounwind readnone speculatable
-declare void @llvm.dbg.value(metadata, metadata, metadata) #3
+declare void @llvm.dbg.value(metadata, metadata, metadata) #0
+
+attributes #0 = { nounwind readnone speculatable }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5}
!llvm.ident = !{!6}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 7.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "test.c", directory: "/dir")
!2 = !{}
@@ -123,13 +122,12 @@
!45 = !DILocation(line: 16, column: 7, scope: !46)
!46 = distinct !DILexicalBlock(scope: !34, file: !1, line: 16, column: 6)
!47 = !DILocation(line: 16, column: 6, scope: !34)
!48 = !DILocation(line: 17, column: 3, scope: !49)
!49 = distinct !DILexicalBlock(scope: !46, file: !1, line: 16, column: 11)
!50 = !DILocation(line: 18, column: 3, scope: !49)
!51 = !DILocation(line: 21, column: 9, scope: !34)
!52 = !DILocation(line: 23, column: 6, scope: !34)
-!53 = !DILocation(line: 24, column: 3, scope: !54)
+!53 = !DILocation(line: 25, column: 3, scope: !54)
!54 = distinct !DILexicalBlock(scope: !55, file: !1, line: 23, column: 11)
!55 = distinct !DILexicalBlock(scope: !34, file: !1, line: 23, column: 6)
-!56 = !DILocation(line: 25, column: 3, scope: !54)
-!57 = !DILocation(line: 28, column: 2, scope: !34)
+!56 = !DILocation(line: 28, column: 2, scope: !34)
https://reviews.llvm.org/D42541
More information about the llvm-commits
mailing list