brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 78e2e19 Raw
69 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s | FileCheck %s3 4; This test checks to make sure that we outline getelementptr instructions only5; when all the operands after the first are the exact same. In this case, we6; outline from the first two functions, but not the third.7 8%struct.RT = type { i8, [10 x [20 x i32]], i8 }9%struct.ST = type { i32, double, %struct.RT }10 11define void @function1(ptr %s, i64 %t) {12; CHECK-LABEL: @function1(13; CHECK-NEXT:  entry:14; CHECK-NEXT:    [[A:%.*]] = alloca i32, align 415; CHECK-NEXT:    [[B:%.*]] = alloca i32, align 416; CHECK-NEXT:    call void @outlined_ir_func_0(ptr [[A]], ptr [[B]], ptr [[S:%.*]], i64 [[T:%.*]])17; CHECK-NEXT:    ret void18;19entry:20  %a = alloca i32, align 421  %b = alloca i32, align 422  store i32 2, ptr %a, align 423  store i32 3, ptr %b, align 424  %0 = getelementptr inbounds %struct.ST, ptr %s, i64 %t, i32 125  ret void26}27 28define void @function2(ptr %s, i64 %t) {29; CHECK-LABEL: @function2(30; CHECK-NEXT:  entry:31; CHECK-NEXT:    [[A:%.*]] = alloca i32, align 432; CHECK-NEXT:    [[B:%.*]] = alloca i32, align 433; CHECK-NEXT:    call void @outlined_ir_func_0(ptr [[A]], ptr [[B]], ptr [[S:%.*]], i64 [[T:%.*]])34; CHECK-NEXT:    ret void35;36entry:37  %a = alloca i32, align 438  %b = alloca i32, align 439  store i32 2, ptr %a, align 440  store i32 3, ptr %b, align 441  %0 = getelementptr inbounds %struct.ST, ptr %s, i64 %t, i32 142  ret void43}44 45define void @function3(ptr %s, i64 %t) {46; CHECK-LABEL: @function3(47; CHECK-NEXT:  entry:48; CHECK-NEXT:    [[A:%.*]] = alloca i32, align 449; CHECK-NEXT:    [[B:%.*]] = alloca i32, align 450; CHECK-NEXT:    store i32 2, ptr [[A]], align 451; CHECK-NEXT:    store i32 3, ptr [[B]], align 452; CHECK-NEXT:    [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_ST:%.*]], ptr [[S:%.*]], i64 [[T:%.*]], i32 053; CHECK-NEXT:    ret void54;55entry:56  %a = alloca i32, align 457  %b = alloca i32, align 458  store i32 2, ptr %a, align 459  store i32 3, ptr %b, align 460  %0 = getelementptr inbounds %struct.ST, ptr %s, i64 %t, i32 061  ret void62}63 64; CHECK: define internal void @outlined_ir_func_0(ptr [[ARG0:%.*]], ptr [[ARG1:%.*]], ptr [[ARG2:%.*]], i64 [[ARG3:%.*]])65; CHECK: entry_to_outline:66; CHECK-NEXT:    store i32 2, ptr [[ARG0]], align 467; CHECK-NEXT:    store i32 3, ptr [[ARG1]], align 468; CHECK-NEXT:    [[TMP0:%.*]] = getelementptr inbounds %struct.ST, ptr [[ARG2]], i64 [[ARG3]], i32 169