[PATCH] D14996: [WinEH] Avoid infinite loop in BranchFolding for multiple single block funclets

Joseph Tremoulet via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 13:43:18 PST 2015


JosephTremoulet added a comment.

In http://reviews.llvm.org/D14996#298891, @andrew.w.kaylor wrote:

> After looking at this closer, I don't think the problem can arise without EH pads.
>
> The condition for moving a block to the end looks like this:
>  ...


I can't think of another example myself, but then that leaves me confused as to why this clause is here in the first place.  Looking at http://reviews.llvm.org/rL31149 where it was introduced, I don't see mention or tests for this specific clause, so it seems plausible that this case was added just for completeness but hasn't actually been exercised before...


================
Comment at: lib/CodeGen/BranchFolding.cpp:1568
@@ +1567,3 @@
+        // take care to avoid endlessly shuffling them past each other.
+        if (MBB->isEHFuncletEntry()) {
+          // If this funclet has successors (either it is a catch that returns
----------------
What would you think of changing this to `assert(MBB->isEHFuncletEntry())` to verify your analysis and ensure we won't loop infinitely with other cases (if they ever arise)?


Repository:
  rL LLVM

http://reviews.llvm.org/D14996





More information about the llvm-commits mailing list