dzhidzhoev wrote:

> > I've modified DebugImportant locally, so that, as I believe, it should be 
> > able to cache DIGlobalVariableExpressions (it's here 
> > https://github.com/dzhidzhoev/llvm-project/commits/debuginfo/rfc-krisb/6/rebased/).
> >  Then I ran the test from the gist mentioned above 
> > (https://gist.github.com/dzhidzhoev/34364710e5478a30ab1023239026e04d). I 
> > get the following output: 
> > https://gist.github.com/dzhidzhoev/4da6642e9a02817a2ca738d38d55bd65. 
> > di_global_variable_expression's and di_global_variable's for "a" and "b" 
> > are duplicated.
> 
> Thanks for sharing the output. The variables are indeed not uniqued due to 
> the different subprograms. It seems like we need to make either 
> DIGlobalVariableAttr or DIGlobalVariableExpressionsAttr self recursive. 
> Apparently, the first variable that has cyclic dependencies in traversal 
> order needs to be self recursive.
> 
> Changing DIGlobalVariableAttr seems easier since it is a DINodeAttr. There is 
> a recent PR that shows the necessary steps to make a node self recursive 
> #190808. It is somewhat involved which is why I wanted to understand that 
> this step is necessary.

@chbessonova did some investigation, and it turns out that the same issue also 
affects DILocalVariables, which already live in `retainedNodes`. 
See https://gist.github.com/chbessonova/67fc7460ee6a148dd0f9734a25b37564. When 
`bin/mlir-translate -import-llvm -mlir-print-debuginfo 
dilocalvariable-duplication.ll`
is run on it, the output contains duplicate `#di_local_variable`s.
Would it make more sense to create a separate issue for the duplication problem 
involving DILocalVariables/DIGlobalVariables living in `retainedNodes`, and to 
keep the fix for that separate from this PR?

https://github.com/llvm/llvm-project/pull/187927
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to