1; RUN: opt < %s -instcombine -S | FileCheck %s 2 3target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1" 4target triple = "wasm32-unknown-unknown" 5 6%struct.quux = type { i32 } 7%struct.blam = type <{ %struct.quux }> 8 9declare void @foo() 10declare void @bar(%struct.quux*) 11declare i32 @__gxx_wasm_personality_v0(...) 12 13define void @test() personality i8* bitcast (i32 (...)* @__gxx_wasm_personality_v0 to i8*) { 14bb: 15 %tmp0 = alloca %struct.blam, align 4 16 br i1 undef, label %bb1, label %bb2 17 18bb1: ; preds = %bb 19 %tmp1 = getelementptr inbounds %struct.blam, %struct.blam* %tmp0, i32 0, i32 0 20 invoke void @foo() 21 to label %bb3 unwind label %bb4 22 23bb2: ; preds = %bb 24 %tmp2 = getelementptr inbounds %struct.blam, %struct.blam* %tmp0, i32 0, i32 0 25 invoke void @foo() 26 to label %bb3 unwind label %bb4 27 28bb3: ; preds = %bb2, %bb1 29 unreachable 30 31bb4: ; preds = %bb2, %bb1 32 ; This PHI should not be combined into a non-PHI instruction, because 33 ; catchswitch BB cannot have any non-PHI instruction other than catchswitch 34 ; itself. 35 ; CHECK: bb4: 36 ; CHECK-NEXT: phi 37 ; CHECK-NEXT: catchswitch 38 %tmp3 = phi %struct.quux* [ %tmp1, %bb1 ], [ %tmp2, %bb2 ] 39 %tmp4 = catchswitch within none [label %bb5] unwind label %bb7 40 41bb5: ; preds = %bb4 42 %tmp5 = catchpad within %tmp4 [i8* null] 43 invoke void @foo() [ "funclet"(token %tmp5) ] 44 to label %bb6 unwind label %bb7 45 46bb6: ; preds = %bb5 47 unreachable 48 49bb7: ; preds = %bb5, %bb4 50 %tmp6 = cleanuppad within none [] 51 call void @bar(%struct.quux* %tmp3) [ "funclet"(token %tmp6) ] 52 unreachable 53} 54