mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
a5ae26a7a9
Before this change, `EnforceCFGCombingPass` was occasionally failing on `verifyModule` if called from Caliban, with mismatches in the `llvm.dbg.cu` debug metadata. This metadata is a list of `DICompileUnit`, and `verifyModule` was failing inside `verifyCompileUnits` because some of the visited compile unit during the verify were not listed in `llvm.dbg.cu`. One of the reasons of this problem might be that during the enforcing we clone many things in the enforced function, and this may cause the cloned stuff not to update the metadata accordingly. I couldn't track down if this was caused by my misuse of LLVM's API for cloning, of to some actual bug in LLVM. In the end I couldn't find out the exact cause and fix it, so this commit is a workaround. It adds a dependency on `RemoveDbgMetadata`, so that the debug metadata causing `verifyModule` to fail are removed before the enforcing, hence preventing things going astray during the enforcing, and fixing the failure. This workaround should be fine, because this is one of the last steps before generating C code, and debug info are note serialized to C anyway.