[llvm] [Verifier] Reject cyclic DIScope parent chains (PR #217997)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 02:50:38 PDT 2026


================
@@ -164,6 +164,9 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
   /// Keep track which DISubprogram is attached to which function.
   DenseMap<const DISubprogram *, const Function *> DISubprogramAttachments;
 
+  /// Cache of whether following a DIScope's scope chain repeats a node.
+  DenseMap<const Metadata *, bool> DIScopeCycleCache;
----------------
jmmartinez wrote:

Does it make sense to cache the `true` cases? Do we report all of the verifier failures or only stop at the first?

If we stop at the first case only, we could have a `SmallPtrSet<const Metadata*> DIScopesKnownToNotCycle` kind of member.

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


More information about the llvm-commits mailing list