[PATCH] D26256: [InstCombine] Don't set debug location when folding through a phi node

Robert Lougher via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 2 13:19:19 PDT 2016


rob.lougher added a comment.

In https://reviews.llvm.org/D26256#586214, @aprantl wrote:

> Shouldn't it only drop the location if the two locations are distinct (and perhaps add a discriminator)?


Yes, I thought about that.  As the two instructions feed into a phi node they are in different basic-blocks, so we're back to talking about the situation where we have an if-then-else all on a single line.  In this case we could create a new debug location with a new discriminator (different scope).  I don't know the debug info code well enough to do this at the moment...

> I mentioned this previously: I think it would be great to add an API that goes something like:
>  `DILocation mergeDebugLoc(DILocation A, DILocation B)`
>  that is invoked in cases like this and then decides what to do depending on the two incoming locations.

That would be nice.

> - adrian


https://reviews.llvm.org/D26256





More information about the llvm-commits mailing list