In the case that there is a debug value on the truncate instruction and none on the sign extend, transfer it from truncate to sign extend so it does not get lost. Also adding a test case showing the debug information in IR will result in a debug value at code generation.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Generally the test case should just test the optimization - no need to go
all the way through codegen, etc.
what's the current behavior if both instructions have a location?
& why is this in an else if block? Why should it not happen if the ifs
above it are true?
Good questions.
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.