brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.7 KiB · 4161845 Raw
193 lines · plain
1; RUN: llc < %s -O1 -mtriple thumbv7-apple-ios6 | FileCheck %s2; Just make sure no one tries to make the assumption that the normal edge of an3; invoke is never a critical edge.  Previously, this code would assert.4 5%struct.__CFString = type opaque6 7declare void @bar(ptr, ptr)8 9define noalias ptr @foo(ptr nocapture %inRefURL) noreturn ssp personality ptr @__gxx_personality_sj0 {10entry:11  %call = tail call ptr @bar3()12  %call2 = invoke ptr @bar2()13          to label %for.cond unwind label %lpad14 15for.cond:                                         ; preds = %entry, %for.cond16  invoke void @bar(ptr undef, ptr null)17          to label %for.cond unwind label %lpad518 19lpad:                                             ; preds = %entry20  %0 = landingpad { ptr, i32 }21          cleanup22  %1 = extractvalue { ptr, i32 } %0, 023  %2 = extractvalue { ptr, i32 } %0, 124  br label %ehcleanup25 26lpad5:                                            ; preds = %for.cond27  %3 = landingpad { ptr, i32 }28          cleanup29  %4 = extractvalue { ptr, i32 } %3, 030  %5 = extractvalue { ptr, i32 } %3, 131  invoke void @release(ptr %call2)32          to label %ehcleanup unwind label %terminate.lpad.i.i1633 34terminate.lpad.i.i16:                             ; preds = %lpad535  %6 = landingpad { ptr, i32 }36          catch ptr null37  tail call void @terminatev() noreturn nounwind38  unreachable39 40ehcleanup:                                        ; preds = %lpad5, %lpad41  %exn.slot.0 = phi ptr [ %1, %lpad ], [ %4, %lpad5 ]42  %ehselector.slot.0 = phi i32 [ %2, %lpad ], [ %5, %lpad5 ]43  invoke void @release(ptr %call)44          to label %_ZN5SmartIPK10__CFStringED1Ev.exit unwind label %terminate.lpad.i.i45 46terminate.lpad.i.i:                               ; preds = %ehcleanup47  %7 = landingpad { ptr, i32 }48          catch ptr null49  tail call void @terminatev() noreturn nounwind50  unreachable51 52_ZN5SmartIPK10__CFStringED1Ev.exit:               ; preds = %ehcleanup53  %lpad.val = insertvalue { ptr, i32 } undef, ptr %exn.slot.0, 054  %lpad.val12 = insertvalue { ptr, i32 } %lpad.val, i32 %ehselector.slot.0, 155  resume { ptr, i32 } %lpad.val1256}57 58declare ptr @bar3()59 60declare ptr @bar2()61 62declare i32 @__gxx_personality_sj0(...)63 64declare void @release(ptr)65 66declare void @terminatev()67 68; Make sure that the instruction DemoteRegToStack inserts to reload69; %call.i.i.i14.i.i follows the instruction that saves the value to the stack in70; basic block %entry.do.body.i.i.i_crit_edge.71; Previously, DemoteRegToStack would insert a load instruction into the entry72; block to reload %call.i.i.i14.i.i before the phi instruction (%0) in block73; %do.body.i.i.i.74 75; CHECK-LABEL: __Z4foo1c:76; CHECK: bl __Znwm77; CHECK: {{.*}}@ %do.body.i.i.i.preheader78; CHECK: str r0, [sp, [[OFFSET:#[0-9]+]]]79; CHECK: {{.*}}@ %do.body.i.i.i80; CHECK: ldr [[R0:r[0-9]+]], [sp, [[OFFSET]]]81; CHECK: cbz [[R0]]82 83%"class.std::__1::basic_string" = type { %"class.std::__1::__compressed_pair" }84%"class.std::__1::__compressed_pair" = type { %"class.std::__1::__libcpp_compressed_pair_imp" }85%"class.std::__1::__libcpp_compressed_pair_imp" = type { %"struct.std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep" }86%"struct.std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep" = type { %union.anon }87%union.anon = type { %"struct.std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__long" }88%"struct.std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__long" = type { i32, i32, ptr }89 90@.str = private unnamed_addr constant [12 x i8] c"some_string\00", align 191 92define void @_Z4foo1c(i8 signext %a) personality ptr @__gxx_personality_sj0 {93entry:94  %s1 = alloca %"class.std::__1::basic_string", align 495  call void @_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm(ptr %s1, ptr @.str, i32 11)96  %call.i.i.i14.i.i = invoke noalias ptr @_Znwm(i32 1024)97          to label %do.body.i.i.i unwind label %lpad.body98 99do.body.i.i.i:                                    ; preds = %entry, %_ZNSt3__116allocator_traitsINS_9allocatorIcEEE9constructIccEEvRS2_PT_RKT0_.exit.i.i.i100  %lsr.iv = phi i32 [ %lsr.iv.next, %_ZNSt3__116allocator_traitsINS_9allocatorIcEEE9constructIccEEvRS2_PT_RKT0_.exit.i.i.i ], [ -1024, %entry ]101  %0 = phi ptr [ %incdec.ptr.i.i.i, %_ZNSt3__116allocator_traitsINS_9allocatorIcEEE9constructIccEEvRS2_PT_RKT0_.exit.i.i.i ], [ %call.i.i.i14.i.i, %entry ]102  %new.isnull.i.i.i.i = icmp eq ptr %0, null103  br i1 %new.isnull.i.i.i.i, label %_ZNSt3__116allocator_traitsINS_9allocatorIcEEE9constructIccEEvRS2_PT_RKT0_.exit.i.i.i, label %new.notnull.i.i.i.i104 105new.notnull.i.i.i.i:                              ; preds = %do.body.i.i.i106  store i8 %a, ptr %0, align 1107  br label %_ZNSt3__116allocator_traitsINS_9allocatorIcEEE9constructIccEEvRS2_PT_RKT0_.exit.i.i.i108 109_ZNSt3__116allocator_traitsINS_9allocatorIcEEE9constructIccEEvRS2_PT_RKT0_.exit.i.i.i: ; preds = %new.notnull.i.i.i.i, %do.body.i.i.i110  %1 = phi ptr [ null, %do.body.i.i.i ], [ %0, %new.notnull.i.i.i.i ]111  %incdec.ptr.i.i.i = getelementptr inbounds i8, ptr %1, i32 1112  %lsr.iv.next = add i32 %lsr.iv, 1113  %cmp.i16.i.i = icmp eq i32 %lsr.iv.next, 0114  br i1 %cmp.i16.i.i, label %invoke.cont, label %do.body.i.i.i115 116invoke.cont:                                      ; preds = %_ZNSt3__116allocator_traitsINS_9allocatorIcEEE9constructIccEEvRS2_PT_RKT0_.exit.i.i.i117  invoke void @_Z4foo2Pci(ptr %call.i.i.i14.i.i, i32 1024)118          to label %invoke.cont5 unwind label %lpad2119 120invoke.cont5:                                     ; preds = %invoke.cont121  %cmp.i.i.i15 = icmp eq ptr %call.i.i.i14.i.i, null122  br i1 %cmp.i.i.i15, label %invoke.cont6, label %_ZNSt3__113__vector_baseIcNS_9allocatorIcEEE5clearEv.exit.i.i.i19123 124_ZNSt3__113__vector_baseIcNS_9allocatorIcEEE5clearEv.exit.i.i.i19: ; preds = %invoke.cont5125  call void @_ZdlPv(ptr %call.i.i.i14.i.i)126  br label %invoke.cont6127 128invoke.cont6:                                     ; preds = %_ZNSt3__113__vector_baseIcNS_9allocatorIcEEE5clearEv.exit.i.i.i19, %invoke.cont5129  %call10 = call ptr @_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev(ptr %s1)130  ret void131 132lpad.body:                                        ; preds = %entry133  %2 = landingpad { ptr, i32 }134          cleanup135  %3 = extractvalue { ptr, i32 } %2, 0136  %4 = extractvalue { ptr, i32 } %2, 1137  br label %ehcleanup138 139lpad2:                                            ; preds = %invoke.cont140  %5 = landingpad { ptr, i32 }141          cleanup142  %6 = extractvalue { ptr, i32 } %5, 0143  %7 = extractvalue { ptr, i32 } %5, 1144  %cmp.i.i.i21 = icmp eq ptr %call.i.i.i14.i.i, null145  br i1 %cmp.i.i.i21, label %ehcleanup, label %_ZNSt3__113__vector_baseIcNS_9allocatorIcEEE5clearEv.exit.i.i.i26146 147_ZNSt3__113__vector_baseIcNS_9allocatorIcEEE5clearEv.exit.i.i.i26: ; preds = %lpad2148  call void @_ZdlPv(ptr %call.i.i.i14.i.i)149  br label %ehcleanup150 151ehcleanup:                                        ; preds = %_ZNSt3__113__vector_baseIcNS_9allocatorIcEEE5clearEv.exit.i.i.i26, %lpad2, %lpad.body152  %exn.slot.0 = phi ptr [ %3, %lpad.body ], [ %6, %lpad2 ], [ %6, %_ZNSt3__113__vector_baseIcNS_9allocatorIcEEE5clearEv.exit.i.i.i26 ]153  %ehselector.slot.0 = phi i32 [ %4, %lpad.body ], [ %7, %lpad2 ], [ %7, %_ZNSt3__113__vector_baseIcNS_9allocatorIcEEE5clearEv.exit.i.i.i26 ]154  %call12 = invoke ptr @_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev(ptr %s1)155          to label %eh.resume unwind label %terminate.lpad156 157eh.resume:                                        ; preds = %ehcleanup158  %lpad.val = insertvalue { ptr, i32 } undef, ptr %exn.slot.0, 0159  %lpad.val13 = insertvalue { ptr, i32 } %lpad.val, i32 %ehselector.slot.0, 1160  resume { ptr, i32 } %lpad.val13161 162terminate.lpad:                                   ; preds = %ehcleanup163  %8 = landingpad { ptr, i32 }164          catch ptr null165  %9 = extractvalue { ptr, i32 } %8, 0166  call void @__clang_call_terminate(ptr %9)167  unreachable168}169 170declare void @_Z4foo2Pci(ptr, i32)171 172define linkonce_odr hidden void @__clang_call_terminate(ptr) {173  %2 = tail call ptr @__cxa_begin_catch(ptr %0)174  tail call void @_ZSt9terminatev()175  unreachable176}177 178declare ptr @__cxa_begin_catch(ptr)179declare void @_ZSt9terminatev()180declare ptr @_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev(ptr returned)181declare void @_ZdlPv(ptr) #3182declare noalias ptr @_Znwm(i32)183declare void @_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm(ptr, ptr, i32)184declare void @_Unwind_SjLj_Register(ptr)185declare void @_Unwind_SjLj_Unregister(ptr)186declare ptr @llvm.frameaddress(i32)187declare ptr @llvm.stacksave()188declare void @llvm.stackrestore(ptr)189declare i32 @llvm.eh.sjlj.setjmp(ptr)190declare ptr @llvm.eh.sjlj.lsda()191declare void @llvm.eh.sjlj.callsite(i32)192declare void @llvm.eh.sjlj.functioncontext(ptr)193