[PATCH] D99334: [TransformUtils] Don't generate invalid llvm.dbg.cu

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 2 11:56:05 PDT 2021


dblaikie added a comment.

In D99334#2661021 <https://reviews.llvm.org/D99334#2661021>, @ldrumm wrote:

> In D99334#2659955 <https://reviews.llvm.org/D99334#2659955>, @dblaikie wrote:
>
>> what was invalid about the metadata? The llvm.dbg.cu list was empty? I wonder if we should just say that's valid. It seems pretty benign/reasonable - makes it easier to write code like this, or code that, say, stripped a CU out wouldn't have to worry about removing a potentially zero-length cu list. @aprantl @JDevlieghere  ?
>
> I don't think that's a good idea. It complexifies every piece of user code around handling "llvm.dbg.cu" if the user can't assume it actually contains what it's supposed to. Doing so is a tradeoff of one `if` statement in `CloneFunctionInto` becoming an extra `if` statement around every use of "llvm.dbg.cu". That's not a good tradeoff in terms of reliability or ergonomics.

Why would code handling llvm.dbg.cu need to add an if statement? I'd expect it to walk through whatever's in llvm.dbg.cu and if there's nothing it'd be fine with that?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99334/new/

https://reviews.llvm.org/D99334



More information about the llvm-commits mailing list