[llvm] [DebugInfo][RemoveDIs] Eliminate another debug-info variation flag (PR #133917)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 2 03:15:39 PDT 2025


================
@@ -171,6 +171,18 @@ static OrderMap orderModule(const Module *M) {
     for (const BasicBlock &BB : F) {
       orderValue(&BB, OM);
       for (const Instruction &I : BB) {
+        // Debug records can contain Value references, that can then contain
+        // Values disconnected from the rest of the Value hierachy, if wrapped
+        // in some kind of constant-expression. Find and order any Values that
+        // are wrapped in debug-info.
+        for (const DbgRecord &R : I.getDbgRecordRange()) {
+          const DbgVariableRecord *VariableRecord =
+              dyn_cast<const DbgVariableRecord>(&R);
+          if (!VariableRecord)
+            continue;
+          for (const Value *V : VariableRecord->location_ops())
+            orderValue(V, OM);
----------------
OCHyams wrote:

I think we also need to check if it's an assign-kind and do the same for the address? (note to self: we still haven't added an "iterator over _all_ the values" iterator).

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


More information about the llvm-commits mailing list