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

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 03:28:21 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);
+      }
+    };
----------------
OCHyams wrote:

This is a good question. I added it because we do it for debug intrinsics already (see below, peering through ValueAsMetadatas). I think you might be right, that it's not needed. But I'm not 100% certain. I'm going to push the rest of the changes for now and dig deeper into this.

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


More information about the llvm-commits mailing list