[PATCH] D67500: [DebugInfo] LiveDebugValues: don't create transfer records for potentially invalid locations
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 4 13:09:59 PST 2020
aprantl added a comment.
Thanks for the writeup, this is very helpful. I am indeed thinking of LiveDebugValues as the first kind of analysis.
One thing that we must define, too, is what `true` and `false` mean in the context of LiveDebugValues. My understanding is that for each DBG_VALUE d in the analyzed MIR function and each instruction i
- true means: "it is correct to insert d at position i"
- false means: "it would be wrong to insert d at position i"
In other words at each instruction i the set of DBG_VALUEs that are "true" are the set of "live" DBG_VALUEs.
As for your loop example: *My* mental model actually used a three-element lattice that is suspiciously close to your second one, but using the opposite direction:
\top (wrong to place DBG_VALUE = false in the above sense / DBG_VALUE is not in the set)
|
true (DBG_VALUE may be placed / DBG_VALUE is in the set)
|
\bot (not fully analyzed yet)
We'd initialize everything with \bot.
join is a commutative function that is
join(x, x) = x
join(x, \bot) = x
join(x, \top) = \top
After processing the first basic block once, we get:
entry: ; {\bot}
dbg.value(%0, ...) ; {true}
br label %loop
loop: ; {\bot}
call void @nop() ; {\bot}
br i1 %cond, label %loop, label %exit ; {\bot}
exit: ; {\bot}
ret void ; {\bot}
processing the second block once, we get
entry: ; {\bot}
dbg.value(%0, ...) ; {true}
br label %loop
loop: ; {join(true (entry), \bot (backedge)) = true}
call void @nop() ; {true}
br i1 %cond, label %loop, label %exit ; {true}
exit: ; {\bot}
ret void ; {\bot}
processing the second block twice, we get
loop: ; {join(true (entry), true (backedge)) = true}
and then true is propagated to the final block. Every time a value changes all successor blocks are added to the worklist. The join function ensures that values can only move in one direction, from \bot -> true -> \top.
I *think* I just described something isomorphic to your type (2), just using other names.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67500/new/
https://reviews.llvm.org/D67500
More information about the llvm-commits
mailing list