[PATCH] D111770: [DebugInfo] When the enum type causes ODR violation, skip ODRUniquing

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 15 21:30:31 PDT 2021


dblaikie added a subscriber: mtrofin.
dblaikie added a comment.

In D111770#3065635 <https://reviews.llvm.org/D111770#3065635>, @ychen wrote:

> In D111770#3065057 <https://reviews.llvm.org/D111770#3065057>, @dblaikie wrote:
>
>> I think this has come up before in llvm-dev threads, etc - could you link to those in the patch description for further context?
>
> Searched llvm-dev with "odr"/"LTO"/"uniquing" didn't find anything closely related. However, https://bugs.llvm.org/show_bug.cgi?id=24923 seems pretty relevant although it is of structure type ODR violation and this patch is for enum/non-enum type ODR violation.

Ah, yeah, that's a generalization of the issue - might be worth fixing the general issue rather than only addressing this (more severe) subset of it. (@aprantl - thoughts?) Guess the generalization is checking both the tag type matches and the size of the type matches too?

Seems the case I was remembering was something @mtrofin came across internally at Google a couple of years ago ( Google internal: b/129559805 ) - yeah, I can't find lots of info on it other than the fact that we fixed the ODR violation by renaming an enum type, but doesn't look like we looked further into fixing (Thin)LTO to not fail in this particular way. (maybe @mtrofin remembers something more of that situation)



================
Comment at: llvm/lib/IR/Verifier.cpp:852-858
+  if (isa<CLASS>(MD)) {                                                        \
+    if (DIScope *N = cast<CLASS>(MD).getScope())                               \
+      AssertDI(N->getTag() != dwarf::DW_TAG_enumeration_type,                  \
+               "enum type is not a scope; check enum type ODR "                \
+               "violation",                                                    \
+               N, &MD);                                                        \
+  }
----------------
Looks like this could be a function template rather than a macro?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111770



More information about the llvm-commits mailing list