[PATCH] D20432: [DAGCombiner] Keep debug information when folding (sext (truncate x)) -> (sextinreg x)

Marianne Mailhot-Sarrasin via llvm-commits llvm-commits at lists.llvm.org
Thu May 19 08:36:30 PDT 2016


mamai added a comment.

Good questions.

In http://reviews.llvm.org/D20432#434357, @dblaikie wrote:

> Generally the test case should just test the optimization - no need to go
>  all the way through codegen, etc.


I there a way to test only the DAGCombiner ?

> what's the current behavior if both instructions have a location?


The behavior (before this patch) was that the debug loc and debug value of the truncate instruction were lost. With this patch, if the truncate has a debug value and the sign extend does not have one, the debug value and debug location of the truncate instruction will replace the ones of the sign extend and therefor they will be forwarded to the new SIGN_EXTEND_INREG.

> & why is this in an else if block? Why should it not happen if the ifs

>  above it are true?


In the case of if/elseif, new nodes are created and they use the SDLoc(N0). So I assumed that in those case, the debug loc of N0 didn't need to be transferred to the sign extension node. But I might be wrong, and it might make sense to transfer the information even with the new nodes using the debug loc of N0. I didn't have a test case for that.


Repository:
  rL LLVM

http://reviews.llvm.org/D20432





More information about the llvm-commits mailing list