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

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 16:43:25 PDT 2015


andrew.w.kaylor added a comment.

As I've been reworking this to handle siblings, my test case has uncovered an ugly problem with the existing cloneCommonBlocks code.

Consider this test case:

  define void @test13() personality i32 (...)* @__CxxFrameHandler3 {
  entry:
    invoke void @f()
      to label %exit unwind label %outer
  
  outer:
    %o = cleanuppad []
    invoke void @f()
      to label %outer.cont unwind label %left
  outer.cont:
    invoke void @f()
      to label %unreachable unwind label %right
  outer.end:
    cleanupendpad %o unwind to caller
  
  left:
    %l = cleanuppad []
    invoke void @f()
      to label %left.cont unwind label %right
  left.cont:
    cleanupret %l unwind label %outer.end
  
  right:
    %r = catchpad []
      to label %right.catch unwind label %right.end
  right.catch:
    invoke void @f()
      to label %unreachable unwind label %right.end
  right.end:
    catchendpad unwind label %outer.end
  
  unreachable:
    unreachable
  }

colorFunclets() will assign the colors 'outer' (because of the cleanupret in 'left.cont') and 'left' (because of the catchendpad in 'right.end') to the 'outer.end' block.  Subsequently, cloneCommonBlocks() will clone 'outer.end' to handle this and assign the color 'outer' to the clone and remove that color from the original, but it doesn't update the predecessors of 'outer.end' and so the cloned block is unreachable and the outer coloring is essentially lost.

I'm working on a solution to this problem now.


Repository:
  rL LLVM

http://reviews.llvm.org/D13274





More information about the llvm-commits mailing list