brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · 4736790 Raw
63 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; Tests that CoroSplit can succesfully determine allocas should live on the frame3; if their aliases are used across suspension points through insertvalue/insertelement.4; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s5 6define ptr @f(i1 %n) presplitcoroutine {7; CHECK-LABEL: define ptr @f(8; CHECK-SAME: i1 [[N:%.*]]) {9; CHECK-NEXT:  [[ENTRY:.*:]]10; CHECK-NEXT:    [[ID:%.*]] = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr @f.resumers)11; CHECK-NEXT:    [[MEM:%.*]] = call ptr @malloc(i32 56)12; CHECK-NEXT:    [[HDL:%.*]] = call noalias nonnull ptr @llvm.coro.begin(token [[ID]], ptr [[MEM]])13; CHECK-NEXT:    store ptr @f.resume, ptr [[HDL]], align 814; CHECK-NEXT:    [[DESTROY_ADDR:%.*]] = getelementptr inbounds nuw [[F_FRAME:%.*]], ptr [[HDL]], i32 0, i32 115; CHECK-NEXT:    store ptr @f.destroy, ptr [[DESTROY_ADDR]], align 816; CHECK-NEXT:    [[X_RELOAD_ADDR:%.*]] = getelementptr inbounds [[F_FRAME]], ptr [[HDL]], i32 0, i32 217; CHECK-NEXT:    [[ALIAS_SPILL_ADDR:%.*]] = getelementptr inbounds [[F_FRAME]], ptr [[HDL]], i32 0, i32 318; CHECK-NEXT:    store i64 0, ptr [[X_RELOAD_ADDR]], align 419; CHECK-NEXT:    store i64 0, ptr [[ALIAS_SPILL_ADDR]], align 420; CHECK-NEXT:    [[X_ALIAS:%.*]] = insertvalue [1 x ptr] poison, ptr [[X_RELOAD_ADDR]], 021; CHECK-NEXT:    [[X_ALIAS_SPILL_ADDR:%.*]] = getelementptr inbounds [[F_FRAME]], ptr [[HDL]], i32 0, i32 422; CHECK-NEXT:    store [1 x ptr] [[X_ALIAS]], ptr [[X_ALIAS_SPILL_ADDR]], align 823; CHECK-NEXT:    [[Y_ALIAS:%.*]] = insertelement <1 x ptr> poison, ptr [[ALIAS_SPILL_ADDR]], i32 024; CHECK-NEXT:    [[Y_ALIAS_SPILL_ADDR:%.*]] = getelementptr inbounds [[F_FRAME]], ptr [[HDL]], i32 0, i32 525; CHECK-NEXT:    store <1 x ptr> [[Y_ALIAS]], ptr [[Y_ALIAS_SPILL_ADDR]], align 826; CHECK-NEXT:    [[INDEX_ADDR1:%.*]] = getelementptr inbounds nuw [[F_FRAME]], ptr [[HDL]], i32 0, i32 627; CHECK-NEXT:    store i1 false, ptr [[INDEX_ADDR1]], align 128; CHECK-NEXT:    ret ptr [[HDL]]29;30entry:31  %x = alloca i6432  %y = alloca i6433  %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)34  %size = call i32 @llvm.coro.size.i32()35  %mem = call ptr @malloc(i32 %size)36  %hdl = call ptr @llvm.coro.begin(token %id, ptr %mem)37  store i64 0, ptr %x38  store i64 0, ptr %y39  %x.alias = insertvalue [1 x ptr] poison, ptr %x, 040  %y.alias = insertelement <1 x ptr> poison, ptr %y, i32 041  %sp1 = call i8 @llvm.coro.suspend(token none, i1 false)42  switch i8 %sp1, label %suspend [i8 0, label %resume43  i8 1, label %cleanup]44resume:45  call void @use1([1 x ptr] %x.alias)46  call void @use2(<1 x ptr> %y.alias)47  br label %cleanup48 49cleanup:50  %mem1 = call ptr @llvm.coro.free(token %id, ptr %hdl)51  call void @free(ptr %mem1)52  br label %suspend53 54suspend:55  call void @llvm.coro.end(ptr %hdl, i1 0, token none)56  ret ptr %hdl57}58 59declare void @use1([1 x ptr])60declare void @use2(<1 x ptr>)61declare noalias ptr @malloc(i32)62declare void @free(ptr)63