brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.4 KiB · 03a49d8 Raw
159 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=licm -S | FileCheck %s3; RUN: opt -aa-pipeline=basic-aa -passes='require<aa>,require<target-ir>,require<scalar-evolution>,require<opt-remark-emit>,loop-mssa(licm)' < %s -S | FileCheck %s4 5target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"6target triple = "i386-pc-windows-msvc18.0.0"7 8define void @test1(ptr %s, i1 %b) personality ptr @__CxxFrameHandler3 {9; CHECK-LABEL: @test1(10; CHECK-NEXT:  entry:11; CHECK-NEXT:    [[TMP0:%.*]] = call i32 @pure_computation()12; CHECK-NEXT:    br label [[WHILE_COND:%.*]]13; CHECK:       while.cond:14; CHECK-NEXT:    br i1 [[B:%.*]], label [[TRY_CONT_LOOPEXIT:%.*]], label [[WHILE_BODY:%.*]]15; CHECK:       while.body:16; CHECK-NEXT:    invoke void @may_throw()17; CHECK-NEXT:            to label [[WHILE_COND]] unwind label [[CATCH_DISPATCH:%.*]]18; CHECK:       catch.dispatch:19; CHECK-NEXT:    [[DOTLCSSA1:%.*]] = phi i32 [ [[TMP0]], [[WHILE_BODY]] ]20; CHECK-NEXT:    [[CS:%.*]] = catchswitch within none [label %catch] unwind to caller21; CHECK:       catch:22; CHECK-NEXT:    [[CP:%.*]] = catchpad within [[CS]] [ptr null, i32 64, ptr null]23; CHECK-NEXT:    store i32 [[DOTLCSSA1]], ptr [[S:%.*]], align 424; CHECK-NEXT:    catchret from [[CP]] to label [[TRY_CONT:%.*]]25; CHECK:       try.cont.loopexit:26; CHECK-NEXT:    br label [[TRY_CONT]]27; CHECK:       try.cont:28; CHECK-NEXT:    ret void29;30entry:31  br label %while.cond32 33while.cond:                                       ; preds = %while.body, %entry34  %0 = call i32 @pure_computation()35  br i1 %b, label %try.cont, label %while.body36 37while.body:                                       ; preds = %while.cond38  invoke void @may_throw()39  to label %while.cond unwind label %catch.dispatch40 41catch.dispatch:                                   ; preds = %while.body42  %.lcssa1 = phi i32 [ %0, %while.body ]43  %cs = catchswitch within none [label %catch] unwind to caller44 45catch:                                            ; preds = %catch.dispatch46  %cp = catchpad within %cs [ptr null, i32 64, ptr null]47  store i32 %.lcssa1, ptr %s48  catchret from %cp to label %try.cont49 50try.cont:                                         ; preds = %catch, %while.cond51  ret void52}53 54define void @test2(ptr %s, i1 %b) personality ptr @__CxxFrameHandler3 {55; CHECK-LABEL: @test2(56; CHECK-NEXT:  entry:57; CHECK-NEXT:    br label [[WHILE_COND:%.*]]58; CHECK:       while.cond:59; CHECK-NEXT:    br i1 [[B:%.*]], label [[TRY_CONT:%.*]], label [[WHILE_BODY:%.*]]60; CHECK:       while.body:61; CHECK-NEXT:    invoke void @may_throw()62; CHECK-NEXT:            to label [[WHILE_COND]] unwind label [[CATCH_DISPATCH:%.*]]63; CHECK:       catch.dispatch:64; CHECK-NEXT:    [[CP:%.*]] = cleanuppad within none []65; CHECK-NEXT:    [[TMP0:%.*]] = call i32 @pure_computation() [ "funclet"(token [[CP]]) ]66; CHECK-NEXT:    store i32 [[TMP0]], ptr [[S:%.*]], align 467; CHECK-NEXT:    cleanupret from [[CP]] unwind to caller68; CHECK:       try.cont:69; CHECK-NEXT:    ret void70;71entry:72  br label %while.cond73 74while.cond:                                       ; preds = %while.body, %entry75  %0 = call i32 @pure_computation()76  br i1 %b, label %try.cont, label %while.body77 78while.body:                                       ; preds = %while.cond79  invoke void @may_throw()80  to label %while.cond unwind label %catch.dispatch81 82catch.dispatch:                                   ; preds = %while.body83  %.lcssa1 = phi i32 [ %0, %while.body ]84  %cp = cleanuppad within none []85  store i32 %.lcssa1, ptr %s86  cleanupret from %cp unwind to caller87 88try.cont:                                         ; preds = %catch, %while.cond89  ret void90}91 92define void @test3(i1 %a, i1 %b, i1 %c) personality ptr @__CxxFrameHandler3 {93; CHECK-LABEL: @test3(94; CHECK-NEXT:  entry:95; CHECK-NEXT:    [[DOTFRAME:%.*]] = alloca i8, align 496; CHECK-NEXT:    [[DOTFRAME2:%.*]] = alloca i8, align 497; CHECK-NEXT:    br i1 [[A:%.*]], label [[TRY_SUCCESS_OR_CAUGHT:%.*]], label [[FORBODY_PREHEADER:%.*]]98; CHECK:       forbody.preheader:99; CHECK-NEXT:    store i32 1, ptr [[DOTFRAME]], align 4100; CHECK-NEXT:    store i32 2, ptr [[DOTFRAME2]], align 4101; CHECK-NEXT:    br label [[FORBODY:%.*]]102; CHECK:       catch.object.Throwable:103; CHECK-NEXT:    [[CP:%.*]] = catchpad within [[CS:%.*]] [ptr null, i32 64, ptr null]104; CHECK-NEXT:    unreachable105; CHECK:       try.success.or.caught.loopexit:106; CHECK-NEXT:    br label [[TRY_SUCCESS_OR_CAUGHT]]107; CHECK:       try.success.or.caught:108; CHECK-NEXT:    ret void109; CHECK:       postinvoke:110; CHECK-NEXT:    br i1 [[B:%.*]], label [[ELSE:%.*]], label [[FORCOND_BACKEDGE:%.*]]111; CHECK:       forcond.backedge:112; CHECK-NEXT:    br i1 [[C:%.*]], label [[TRY_SUCCESS_OR_CAUGHT_LOOPEXIT:%.*]], label [[FORBODY]]113; CHECK:       catch.dispatch:114; CHECK-NEXT:    [[CS]] = catchswitch within none [label %catch.object.Throwable] unwind to caller115; CHECK:       forbody:116; CHECK-NEXT:    invoke void @may_throw()117; CHECK-NEXT:            to label [[POSTINVOKE:%.*]] unwind label [[CATCH_DISPATCH:%.*]]118; CHECK:       else:119; CHECK-NEXT:    invoke void @may_throw()120; CHECK-NEXT:            to label [[FORCOND_BACKEDGE]] unwind label [[CATCH_DISPATCH]]121;122entry:123  %.frame = alloca i8, align 4124  %.frame2 = alloca i8, align 4125  br i1 %a, label %try.success.or.caught, label %forbody126 127catch.object.Throwable:                           ; preds = %catch.dispatch128  %cp = catchpad within %cs [ptr null, i32 64, ptr null]129  unreachable130 131try.success.or.caught:                            ; preds = %forcond.backedge, %0132  ret void133 134postinvoke:                                       ; preds = %forbody135  br i1 %b, label %else, label %forcond.backedge136 137forcond.backedge:                                 ; preds = %else, %postinvoke138  br i1 %c, label %try.success.or.caught, label %forbody139 140catch.dispatch:                                   ; preds = %else, %forbody141  %cs = catchswitch within none [label %catch.object.Throwable] unwind to caller142 143forbody:                                          ; preds = %forcond.backedge, %0144  store i32 1, ptr %.frame, align 4145  store i32 2, ptr %.frame2, align 4146  invoke void @may_throw()147  to label %postinvoke unwind label %catch.dispatch148 149else:                                             ; preds = %postinvoke150  invoke void @may_throw()151  to label %forcond.backedge unwind label %catch.dispatch152}153 154declare void @may_throw()155 156declare i32 @pure_computation() nounwind willreturn memory(none)157 158declare i32 @__CxxFrameHandler3(...)159