[llvm] [RemoveDIs] Read/write DbgRecords directly from/to bitcode (PR #83251)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 08:00:59 PST 2024


================
@@ -261,33 +269,39 @@ static UseListOrderStack predictUseListOrder(const Module &M) {
   // constants in the last Function they're used in.  Module-level constants
   // have already been visited above.
   for (const Function &F : llvm::reverse(M)) {
+    auto PredictValueOrderFromMetadata = [&](Metadata *MD) {
+      if (const auto *VAM = dyn_cast<ValueAsMetadata>(MD)) {
+        predictValueUseListOrder(VAM->getValue(), &F, OM, Stack);
+      } else if (const auto *AL = dyn_cast<DIArgList>(MD)) {
+        for (const auto *VAM : AL->getArgs())
+          predictValueUseListOrder(VAM->getValue(), &F, OM, Stack);
+      }
+    };
----------------
jmorse wrote:

Is it possible that this is flushing out the order of the use list /inside/ the MAV/VAM pairing? I think it's technically possible for that to become visible, if you `findDbgUsers` on a value then move all of it's users to a position, you enumerate them in the use-list order. It's not clear that that's what this code preserves though (perhaps nothing preserves it).

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


More information about the llvm-commits mailing list