[Lldb-commits] [PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

2019-12-04 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp:159
   // FUNC11-BT: func11_tailcalled{{.*}}
   // FUNC11-BT-NEXT: func12{{.*}} [artificial]
   use(x);

djtodoro wrote:
> vsk wrote:
> > The failure was:
> > ```
> > main.cpp:159:21: error: FUNC11-BT-NEXT: expected string not found in input
> >  // FUNC11-BT-NEXT: func12{{.*}} [artificial]
> > ^
> > :3:2: note: scanning from here
> >  frame #1: 0x0001079eae69 a.out`func12(sink=0x7ffee8215cb4, x=123) 
> > at main.cpp:179:3 [opt]
> > ```
> > 
> > The added `DESTROY_RBX` asm might confuse TailRecursionElimination into 
> > believing that the callee accesses the caller's stack. Could you 
> > double-check that a tail call is actually emitted in `func12` (something 
> > like `jmp *%rax`)? If it //is//, this is a pre-existing lldb bug, so the 
> > func12 test should be disabled.
> @vsk Thanks for the comment!
> 
> The problem here is the fresh change in the code production by using the 
> `-O1` level of optimization. More precisely, at very high level, after the 
> D65410 we do not have a tail call where we expected.
> I am proposing using the `-O2` level of the optimizations, since we are 
> testing printing of the entry values in the test case, rather than tail call 
> frames with particular level of optimization.
> WDYT? 
Sounds good to me, thanks for chasing that down!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68209/new/

https://reviews.llvm.org/D68209



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

2019-12-04 Thread Djordje Todorovic via Phabricator via lldb-commits
djtodoro marked an inline comment as done.
djtodoro added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp:159
   // FUNC11-BT: func11_tailcalled{{.*}}
   // FUNC11-BT-NEXT: func12{{.*}} [artificial]
   use(x);

vsk wrote:
> The failure was:
> ```
> main.cpp:159:21: error: FUNC11-BT-NEXT: expected string not found in input
>  // FUNC11-BT-NEXT: func12{{.*}} [artificial]
> ^
> :3:2: note: scanning from here
>  frame #1: 0x0001079eae69 a.out`func12(sink=0x7ffee8215cb4, x=123) at 
> main.cpp:179:3 [opt]
> ```
> 
> The added `DESTROY_RBX` asm might confuse TailRecursionElimination into 
> believing that the callee accesses the caller's stack. Could you double-check 
> that a tail call is actually emitted in `func12` (something like `jmp 
> *%rax`)? If it //is//, this is a pre-existing lldb bug, so the func12 test 
> should be disabled.
@vsk Thanks for the comment!

The problem here is the fresh change in the code production by using the `-O1` 
level of optimization. More precisely, at very high level, after the D65410 we 
do not have a tail call where we expected.
I am proposing using the `-O2` level of the optimizations, since we are testing 
printing of the entry values in the test case, rather than tail call frames 
with particular level of optimization.
WDYT? 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68209/new/

https://reviews.llvm.org/D68209



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

2019-12-03 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp:159
   // FUNC11-BT: func11_tailcalled{{.*}}
   // FUNC11-BT-NEXT: func12{{.*}} [artificial]
   use(x);

The failure was:
```
main.cpp:159:21: error: FUNC11-BT-NEXT: expected string not found in input
 // FUNC11-BT-NEXT: func12{{.*}} [artificial]
^
:3:2: note: scanning from here
 frame #1: 0x0001079eae69 a.out`func12(sink=0x7ffee8215cb4, x=123) at 
main.cpp:179:3 [opt]
```

The added `DESTROY_RBX` asm might confuse TailRecursionElimination into 
believing that the callee accesses the caller's stack. Could you double-check 
that a tail call is actually emitted in `func12` (something like `jmp *%rax`)? 
If it //is//, this is a pre-existing lldb bug, so the func12 test should be 
disabled.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68209/new/

https://reviews.llvm.org/D68209



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

2019-12-03 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Hi,

I'm not sure if you've noticed but the re-enabled TestBasicEntryValuesX86_64.py 
is failing both on linux and mac. An example of breakage can be found here: 
http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/4338/testReport/ (you 
can ignore the TestReturnValue.py failure -- that's an unrelated concurrent 
breakage which has been since fixed).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68209/new/

https://reviews.llvm.org/D68209



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

2019-12-03 Thread Djordje Todorovic via Phabricator via lldb-commits
djtodoro added a comment.

Reverted while investigating. I am not sure what happened, since the test 
passed on my machine. Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68209/new/

https://reviews.llvm.org/D68209



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

2019-12-03 Thread Djordje Todorovic via Phabricator via lldb-commits
djtodoro added a comment.

Thanks for the reviews!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68209/new/

https://reviews.llvm.org/D68209



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

2019-12-03 Thread Djordje Todorovic via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4cfceb910692: [LiveDebugValues] Introduce entry values of 
unmodified params (authored by djtodoro).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68209/new/

https://reviews.llvm.org/D68209

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
  
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp
  llvm/lib/CodeGen/LiveDebugValues.cpp
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir
  llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/kill-entry-value-after-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir

Index: llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
===
--- /dev/null
+++ llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
@@ -0,0 +1,184 @@
+# RUN: llc -debug-entry-values -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
+#
+#extern void fn1 (int, int, int);
+#__attribute__((noinline))
+#int
+#fn2 (int a, int b, int c) {
+#  int q = 2 + a;
+#  fn1 (5, 6, q);
+#  if (b < 17) {
+#b = b + 7;
+# fn1 (5, b, q);
+#  } else {
+#b = b + 1;
+#fn1 (1, b, q);
+#  }
+#  return b;
+#}
+# CHECK: ![[ARG_C:.*]] = !DILocalVariable(name: "c"
+# CHECK: bb.0.entry:
+# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)
+# CHECK: bb.1.if.then:
+# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)
+# CHECK: bb.2.if.else:
+# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)
+# CHECK: bb.3.if.end:
+# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)
+#
+--- |
+  ; ModuleID = 'test.c'
+  source_filename = "test.c"
+  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+  target triple = "x86_64-unknown-linux-gnu"
+
+  ; Function Attrs: noinline nounwind uwtable
+  define dso_local i32 @fn2(i32 %a, i32 %b, i32 %c) local_unnamed_addr !dbg !12 {
+  entry:
+call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !20
+call void @llvm.dbg.value(metadata i32 %b, metadata !17, metadata !DIExpression()), !dbg !20
+call void @llvm.dbg.value(metadata i32 %c, metadata !18, metadata !DIExpression()), !dbg !20
+%add = add nsw i32 %a, 2, !dbg !21
+call void @llvm.dbg.value(metadata i32 %add, metadata !19, metadata !DIExpression()), !dbg !20
+tail call void @fn1(i32 5, i32 6, i32 %add), !dbg !22
+%cmp = icmp slt i32 %b, 17, !dbg !23
+br i1 %cmp, label %if.then, label %if.else, !dbg !25
+
+  if.then:  ; preds = %entry
+%add1 = add nsw i32 %b, 7, !dbg !26
+call void @llvm.dbg.value(metadata i32 %add1, metadata !17, metadata !DIExpression()), !dbg !20
+tail call void @fn1(i32 5, i32 %add1, i32 %add), !dbg !28
+br label %if.end, !dbg !29
+
+  if.else:  ; preds = %entry
+%add2 = add nuw nsw i32 %b, 1, !dbg !30
+call void @llvm.dbg.value(metadata i32 %add2, metadata !17, metadata !DIExpression()), !dbg !20
+tail call void @fn1(i32 1, i32 %add2, i32 %add), !dbg !32
+br label %if.end
+
+  if.end:   ; preds = %if.else, %if.then
+%b.addr.0 = phi i32 [ %add1, %if.then ], [ %add2, %if.else ], !dbg !33
+call void @llvm.dbg.value(metadata i32 %b.addr.0, metadata !17, metadata !DIExpression()), !dbg !20
+ret i32 %b.addr.0, !dbg !34
+  }
+
+  declare !dbg !4 dso_local void @fn1(i32, i32, i32) local_unnamed_addr
+
+  ; Function Attrs: nounwind readnone speculatable willreturn
+  declare void @llvm.dbg.value(metadata, metadata, metadata)
+
+  !llvm.dbg.cu = !{!0}
+  !llvm.module.flags = !{!8, !9, !10}
+  !llvm.ident = !{!11}
+
+  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
+  !1 = !DIFile(filename: "test.c", directory: "/")
+  !2 = !{}
+  !3 = !{!4}
+  !4 = !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
+  !5 = !DISubroutineType(types: !6)
+  !6 = !{null, !7, !7, !7}
+  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+  !8 = !{i32 2, !"Dwarf Version", i32 4}
+  !9 = !{i32 2, !"Debug Info Version", i32 3}
+  !10 = !{i32 1, !"wchar_size", i32 4}
+  !11 = !{!"clang version 10.0.0"}
+  !