[PATCH] [GVN] Set proper debug locations for some instructions created by GVN.

Alexey Samsonov vonosmas at gmail.com
Tue Jun 9 17:53:34 PDT 2015


In http://reviews.llvm.org/D10351#185951, @dberlin wrote:

> No, they aren't, and it will in fact, often get the wrong location for this.
>
> But given how GVN works, and the expectation that it has that
>  phitransaddr will insert instructions for it,
>  this is pretty much the best you can do (unless you want to do nothing).
>
> This is because PHITransAddr does not have any clue in the world about
>  what computation it is really going to eventually replace, and GVN
>  can't tell it, because GVN doesn't know either.
>
> (Basically, GVN is asking phi translate "here's a load, translate all
>  of it's parts". PHI Translate doesn't just do phi translation, it will
>  in fact, go off looking to see if something might have the same
>  operands as the result, etc).


Right... But why is this wrong? Suppose GVN replaces a Load L in the basic block BB_3,
and the address computation for L involves values V1 from BB_1 (with location Loc_1) and V2 from BB_2 (with location Loc_2).

PHITransAddr basically just re-creates the address computation in some predecessor of BB_3.
Shouldn't instructions re-computing V1 and V2 be associated with the same locations Loc_1 and Loc_2 as the original values?

> It will be "mostly" right for "depth 1" phi translation, however.





http://reviews.llvm.org/D10351

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list