brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · 250f8a1 Raw
70 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes='sroa<preserve-cfg>' -S | FileCheck %s --check-prefixes=CHECK,CHECK-PRESERVE-CFG3; RUN: opt < %s -passes='sroa<modify-cfg>' -S | FileCheck %s --check-prefixes=CHECK,CHECK-MODIFY-CFG4 5target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"6target triple = "wasm32-unknown-unknown"7 8%struct.foo = type { i32 }9declare i32 @__gxx_wasm_personality_v0(...)10declare void @foo()11 12; Tests if the SROA pass correctly bails out on rewriting PHIs in a catchswitch13; BB.14define void @test_phi_catchswitch() personality ptr @__gxx_wasm_personality_v0 {15; CHECK-LABEL: @test_phi_catchswitch(16; CHECK-NEXT:  entry:17; CHECK-NEXT:    [[TMP:%.*]] = alloca [[STRUCT_FOO:%.*]], align 418; CHECK-NEXT:    invoke void @foo()19; CHECK-NEXT:    to label [[BB3:%.*]] unwind label [[BB10:%.*]]20; CHECK:       bb3:21; CHECK-NEXT:    invoke void @foo()22; CHECK-NEXT:    to label [[BB9:%.*]] unwind label [[CATCH_DISPATCH:%.*]]23; CHECK:       catch.dispatch:24; CHECK-NEXT:    [[TMP5:%.*]] = phi ptr [ [[TMP]], [[BB3]] ]25; CHECK-NEXT:    [[TMP6:%.*]] = catchswitch within none [label %catch.start] unwind label [[BB10]]26; CHECK:       catch.start:27; CHECK-NEXT:    [[TMP8:%.*]] = catchpad within [[TMP6]] [ptr null]28; CHECK-NEXT:    unreachable29; CHECK:       bb9:30; CHECK-NEXT:    unreachable31; CHECK:       bb10:32; CHECK-NEXT:    [[TMP11:%.*]] = phi ptr [ [[TMP]], [[ENTRY:%.*]] ], [ [[TMP5]], [[CATCH_DISPATCH]] ]33; CHECK-NEXT:    [[TMP12:%.*]] = cleanuppad within none []34; CHECK-NEXT:    store i32 0, ptr [[TMP11]], align 435; CHECK-NEXT:    unreachable36;37entry:38  %tmp = alloca %struct.foo, align 439  invoke void @foo()40  to label %bb3 unwind label %bb1041 42bb3:                                              ; preds = %entry43  invoke void @foo()44  to label %bb9 unwind label %catch.dispatch45 46catch.dispatch:                                   ; preds = %bb347  ; While rewriting the alloca in the entry BB, the SROA pass tries to insert a48  ; non-PHI instruction in this BB by calling getFirstInsertionPt(), which is49  ; not possible in a catchswitch BB. This test checks if we correctly bail out50  ; on these cases.51  %tmp5 = phi ptr [ %tmp, %bb3 ]52  %tmp6 = catchswitch within none [label %catch.start] unwind label %bb1053 54catch.start:                                      ; preds = %catch.dispatch55  %tmp8 = catchpad within %tmp6 [ptr null]56  unreachable57 58bb9:                                              ; preds = %bb359  unreachable60 61bb10:                                             ; preds = %catch.dispatch, %entry62  %tmp11 = phi ptr [ %tmp, %entry ], [ %tmp5, %catch.dispatch ]63  %tmp12 = cleanuppad within none []64  store i32 0, ptr %tmp11, align 465  unreachable66}67;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:68; CHECK-MODIFY-CFG: {{.*}}69; CHECK-PRESERVE-CFG: {{.*}}70