[PATCH] D24117: Fix inliner funclet unwind memoization

Joseph Tremoulet via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 20:26:40 PDT 2016

JosephTremoulet added inline comments.

Comment at: lib/Transforms/Utils/InlineFunction.cpp:423-431
@@ +422,11 @@
+    if (Memo != MemoMap.end() && Memo->second) {
+      // EHPad must have a descendant that unwinds to a different descendant
+      // of EHPad.  This local unwind gives us no information about EHPad.
+      // Leave it and the subtree rooted at it alone.
+#ifndef NDEBUG
+      auto *UnwindAncestor = getParentPad(Memo->second);
+      while (UnwindAncestor && UnwindAncestor != EHPad)
+        UnwindAncestor = getParentPad(UnwindAncestor);
+      assert(UnwindAncestor == EHPad);
+      continue;
Oops, I think that the `continue` here is right but the debug check is over-zealous -- this might be a local unwind off in some cousin of `EHPad` in the case that `EHPad` has useless ancestors.  I think instead that since `UselessPad`'s parent has no information, we can assert that the unwind dest is a sibling of `UselessPad` (since otherwise the exiting would have needed to propagate up to the parent).  Will add testcase to verify and update.


More information about the llvm-commits mailing list