Split resolveCycles(bool AllowTemps) into two interfaces and document
[oota-llvm.git] / lib / Transforms / Utils / ValueMapper.cpp
index 2e361d38ed0b6627c3772f647a5b4baab31d6adc..f47ddb9f064f54a2afec84f7482835f776fe5673 100644 (file)
@@ -222,8 +222,17 @@ static void resolveCycles(Metadata *MD, bool AllowTemps) {
   if (auto *N = dyn_cast_or_null<MDNode>(MD)) {
     if (AllowTemps && N->isTemporary())
       return;
-    if (!N->isResolved())
-      N->resolveCycles(AllowTemps);
+    if (!N->isResolved()) {
+      if (AllowTemps)
+        // Note that this will drop RAUW support on any temporaries, which
+        // blocks uniquing. If this ends up being an issue, in the future
+        // we can experiment with delaying resolving these nodes until
+        // after metadata is fully materialized (i.e. when linking metadata
+        // as a postpass after function importing).
+        N->resolveNonTemporaries();
+      else
+        N->resolveCycles();
+    }
   }
 }