[PATCH] D13274: [WinEH] Clone funclets with multiple parents

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 14:17:23 PDT 2015


majnemer added a comment.

Intuitively, I'd expect cloning a funclet results in the creation of a new PHI if there are live-outs in the original funclet.  Is this case impossible?


================
Comment at: lib/CodeGen/WinEHPrepare.cpp:3184-3196
@@ +3183,15 @@
+
+    // Tidy up if the PHI node has become trivial.
+    unsigned RemainingValues = PN->getNumIncomingValues();
+    if (!RemainingValues) {
+      PHIsToErase.push_back(PN);
+    } else if (RemainingValues == 1) {
+      auto *PV = PN->getIncomingValue(0);
+      if (PV != PN)
+          PN->replaceAllUsesWith(PV);
+        else
+          // We are left with an infinite loop with no entries: kill the PHI.
+          PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
+      PHIsToErase.push_back(PN);
+    }
+  }
----------------
Is this strictly necessary? Will the code in cleanupPreparedFunclets not handle these cases?


Repository:
  rL LLVM

http://reviews.llvm.org/D13274





More information about the llvm-commits mailing list