[PATCH] D57702: [SelectionDAGBuilder] Add restrictions to EmitFuncArgumentDbgValue

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 9 17:13:24 PST 2019


bjope marked an inline comment as done.
bjope added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:5023
+    // is an input parameter. But they are not really related to each other.
+    // I'm not really sure how to check that, so instead we make sure that we do
+    // not describe the same argument twice since that seems to do the trick.
----------------
aprantl wrote:
> That is not generally possible. For example:
> ```
> $ cat /tmp/s.c 
> struct s { long long int i, j; };
> 
> int f(struct s s) {
>   return s.i+s.j;
> }
> 
> $ clang -g -S -emit-llvm /tmp/s.c -o -
> ; ModuleID = '/tmp/s.c'
> source_filename = "/tmp/s.c"
> target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
> target triple = "x86_64-apple-macosx10.14.0"
> 
> %struct.s = type { i64, i64 }
> 
> ; Function Attrs: noinline nounwind optnone ssp uwtable
> define i32 @f(i64 %s.coerce0, i64 %s.coerce1) #0 !dbg !8 {
> entry:
> 
> ```
> 
> Here you'd have two dbg.values referring to the same DILocalVariable, but with different DIExpressions (with different DW_OP_LLVM_fragment). Since this case is so easy to reproduce, it would be good to at least handle it. The opposite (two DILocalVariables referring to the same function parameter) seems less interesting to me.
> 
The code handles the situation with fragments from your example. I've now added test/DebugInfo/X86/dbg-value-funcarg2.ll which is a little bit inspired by your example.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D57702





More information about the llvm-commits mailing list