[clang] [llvm] Disentangle DISubprogram ODR type method uniquing from metadata uniquing (PR #217042)

Orlando Cazalet-Hyams via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 1 03:56:23 PDT 2026


================
@@ -1440,4 +1440,84 @@ TEST_F(CloneModule, GlobalWithBlockAddressesInitializer) {
   ASSERT_NE(OriginalBa->getBasicBlock(), ClonedBa->getBasicBlock());
 }
 
+TEST_F(CloneModule, ODRUniqueTypeMethodVerifier) {
+  // Test that the following IR, reduced from a self-host clang-22 compile,
+  // doesn't trip the verifier after cloning.
----------------
OCHyams wrote:

It _can_ be replicated from the command line: you need to tell opt or llc to run twice to force a module clone, which in the case of opt I think requires enabling the old pass manager, and you need to pass `-disable-debug-info-type-map` too to avoid the parser accidentally fixing the issue by making the DISubprogram's scope, a DICompositeType, distinct.

I agree this unittest feels a bit weird, but my thinking was the steps above for a lit test seemed a convoluted way to force the necessary conditions and that this was a bit cleaner. Happy to revert to the lit test method if you feel it is better on balance.

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


More information about the cfe-commits mailing list