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

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 17:16:18 PDT 2015


majnemer added a comment.

In http://reviews.llvm.org/D13274#261224, @andrew.w.kaylor wrote:

> 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.


Isn't this IR busted because there is no associated cleanupendpad for `%l`?
Also, why does the cleanupendpad get more than one color? That sounds very strange because you'd never want to clone it without cloning `%o`... I'd expect that it either have it's own color or have cleanuppad's color (and propagate the colors feeding into cleanuppad).


Repository:
  rL LLVM

http://reviews.llvm.org/D13274





More information about the llvm-commits mailing list