[PATCH] D41924: dagcombine: Transfer debug information when folding (zext (truncate x)) -> (zext (truncate x))

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 11:32:42 PST 2018


aprantl added a comment.

In https://reviews.llvm.org/D41924#973598, @efriedma wrote:

> The transform here is really trunc+zext->and+zext.  DAGCombine naturally transfers the debug into from the old zext to the new zext; what the explicit call to transferDbgValues is doing here is transfering debug info from the old *trunc* to the new zext.


That's what the top-level comment says, but in this particular code path I don't actually see and AND being generated. What am I missing?

> It seems a little dubious to transferDbgValues between two nodes which don't have the same type, but I guess it works out here because the debugger implicitly truncates the result of the zext?  How exactly does that work?  The code could use a better comment to clarify this.

Debug info also encodes the type (and thus size) of the source variable being represented, so is immune to zero-extend and truncate operations that deal with the value being in a register that is larger than the variable.  That said, we don't explicitly check that the extend/truncate operations don't reach inside the variable here.


Repository:
  rL LLVM

https://reviews.llvm.org/D41924





More information about the llvm-commits mailing list