[llvm] [DebugInfo][InstCombine] When replacing bswap idiom, add DebugLoc to new insts (PR #114231)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 15:38:49 PST 2024


SLTozer wrote:

> I guess it's probably fine, but does feel a bit weird & not entirely consistent with the new policy we've discussed, where only the instruction that produces the final result that matches the original instruction should have the new location, I guess, maybe?

There might have been some ambiguity in the explanation; the new example on the policy update I gave covers this a bit more directly, but it could be made more explicit. As I see it, the set of new instructions that, in sequence, produce the final value of the old instruction(s) that we're replacing, should all be assigned the location of the replaced instruction (or the merge of those locations if there were multiple). The reason for this is the same as in cases where we lower an IR instruction into multiple MIR/assembly instructions and apply its DebugLoc to all of them: even if we create multiple instructions, they're all working towards the single output value.



https://github.com/llvm/llvm-project/pull/114231


More information about the llvm-commits mailing list