brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.2 KiB · 95bb7be Raw
126 lines · plain
1; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s2%promise_type = type { i8 }3%struct.A = type <{ i64, i64, i32, [4 x i8] }>4 5; Function Attrs: noinline ssp uwtable mustprogress6define ptr @foo(ptr nocapture readonly byval(%struct.A) align 8 %a1) #0 {7entry:8  %__promise = alloca %promise_type, align 19  %a2 = alloca %struct.A, align 810  %0 = call token @llvm.coro.id(i32 16, ptr nonnull %__promise, ptr @foo, ptr null)11  %1 = call i1 @llvm.coro.alloc(token %0)12  br i1 %1, label %coro.alloc, label %coro.init13 14coro.alloc:                                       ; preds = %entry15  %2 = call i64 @llvm.coro.size.i64()16  %call = call noalias nonnull ptr @_Znwm(i64 %2) #917  br label %coro.init18 19coro.init:                                        ; preds = %coro.alloc, %entry20  %3 = phi ptr [ null, %entry ], [ %call, %coro.alloc ]21  %4 = call ptr @llvm.coro.begin(token %0, ptr %3) #1022  call void @llvm.lifetime.start.p0(ptr nonnull %__promise) #223  %call2 = call ptr @_ZN4task12promise_type17get_return_objectEv(ptr nonnull dereferenceable(1) %__promise)24  call void @initial_suspend(ptr nonnull dereferenceable(1) %__promise)25  %5 = call token @llvm.coro.save(ptr null)26  call fastcc void @_ZNSt12experimental13coroutines_v116coroutine_handleIN4task12promise_typeEE12from_addressEPv(ptr %4) #227  %6 = call i8 @llvm.coro.suspend(token %5, i1 false)28  switch i8 %6, label %coro.ret [29    i8 0, label %init.ready30    i8 1, label %cleanup3331  ]32 33init.ready:                                       ; preds = %coro.init34  call void @llvm.lifetime.start.p0(ptr nonnull %a2) #235  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %a2, ptr align 8 %a1, i64 24, i1 false)36  call void @llvm.lifetime.end.p0(ptr nonnull %a2) #237  call void @_ZN4task12promise_type13final_suspendEv(ptr nonnull dereferenceable(1) %__promise) #238  %7 = call token @llvm.coro.save(ptr null)39  call fastcc void @_ZNSt12experimental13coroutines_v116coroutine_handleIN4task12promise_typeEE12from_addressEPv(ptr %4) #240  %8 = call i8 @llvm.coro.suspend(token %7, i1 true) #1041  %switch = icmp ult i8 %8, 242  br i1 %switch, label %cleanup33, label %coro.ret43 44cleanup33:                                        ; preds = %init.ready, %coro.init45  call void @llvm.lifetime.end.p0(ptr nonnull %__promise) #246  %9 = call ptr @llvm.coro.free(token %0, ptr %4)47  %.not = icmp eq ptr %9, null48  br i1 %.not, label %coro.ret, label %coro.free49 50coro.free:                                        ; preds = %cleanup3351  call void @_ZdlPv(ptr nonnull %9) #252  br label %coro.ret53 54coro.ret:                                         ; preds = %coro.free, %cleanup33, %init.ready, %coro.init55  call void @llvm.coro.end(ptr null, i1 false, token none) #1056  ret ptr %call257}58 59; check that the frame contains the entire struct, instead of just the struct pointer,60; and that the alignment is taken into account.61; CHECK: %foo.Frame = type { ptr, ptr, %promise_type, i1, [6 x i8], %struct.A }62 63; Function Attrs: argmemonly nounwind readonly64declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #165 66; Function Attrs: nounwind67declare i1 @llvm.coro.alloc(token) #268 69; Function Attrs: nobuiltin nofree allocsize(0)70declare nonnull ptr @_Znwm(i64) local_unnamed_addr #371 72; Function Attrs: nounwind readnone73declare i64 @llvm.coro.size.i64() #474 75; Function Attrs: nounwind76declare ptr @llvm.coro.begin(token, ptr writeonly) #277 78; Function Attrs: argmemonly nofree nosync nounwind willreturn79declare void @llvm.lifetime.start.p0(ptr nocapture) #580 81; Function Attrs: argmemonly nofree nounwind willreturn82declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #683 84; Function Attrs: noinline nounwind ssp uwtable willreturn mustprogress85declare ptr @_ZN4task12promise_type17get_return_objectEv(ptr nonnull dereferenceable(1)) local_unnamed_addr #7 align 286 87; Function Attrs: noinline nounwind ssp uwtable willreturn mustprogress88declare void @initial_suspend(ptr nonnull dereferenceable(1)) local_unnamed_addr #7 align 289 90; Function Attrs: nounwind91declare token @llvm.coro.save(ptr) #292 93; Function Attrs: noinline nounwind ssp uwtable willreturn mustprogress94declare hidden fastcc void @_ZNSt12experimental13coroutines_v116coroutine_handleIN4task12promise_typeEE12from_addressEPv(ptr) unnamed_addr #7 align 295 96; Function Attrs: argmemonly nofree nosync nounwind willreturn97declare void @llvm.lifetime.end.p0(ptr nocapture) #598 99; Function Attrs: nounwind100declare i8 @llvm.coro.suspend(token, i1) #2101 102; Function Attrs: noinline nounwind ssp uwtable willreturn mustprogress103declare void @_ZN4task12promise_type13final_suspendEv(ptr nonnull dereferenceable(1)) local_unnamed_addr #7 align 2104 105; Function Attrs: nounwind106declare void @llvm.coro.end(ptr, i1, token) #2107 108; Function Attrs: nobuiltin nounwind109declare void @_ZdlPv(ptr) local_unnamed_addr #8110 111; Function Attrs: argmemonly nounwind readonly112declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1113 114attributes #0 = { noinline ssp uwtable mustprogress presplitcoroutine "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" }115attributes #1 = { argmemonly nounwind readonly }116attributes #2 = { nounwind }117attributes #3 = { nobuiltin nofree allocsize(0) "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" }118attributes #4 = { nounwind readnone }119attributes #5 = { argmemonly nofree nosync nounwind willreturn }120attributes #6 = { argmemonly nofree nounwind willreturn }121attributes #7 = { noinline nounwind ssp uwtable willreturn mustprogress "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" }122attributes #8 = { nobuiltin nounwind "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" }123attributes #9 = { allocsize(0) }124attributes #10 = { noduplicate }125 126