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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 11:19:16 PST 2024


dwblaikie 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.

Fair enough - I can go with that. Sorry if I missed that in the policy wording update.

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


More information about the llvm-commits mailing list