brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 986f291 Raw
60 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 22; RUN: opt < %s -passes=infer-alignment -S | FileCheck %s3 4; ------------------------------------------------------------------------------5; Scalar type6; ------------------------------------------------------------------------------7 8define void @alloca_local(i8 %x, i32 %y) {9; CHECK-LABEL: define void @alloca_local10; CHECK-SAME: (i8 [[X:%.*]], i32 [[Y:%.*]]) {11; CHECK-NEXT:    [[ALLOCA:%.*]] = alloca i32, align 412; CHECK-NEXT:    [[LOAD_I8:%.*]] = load i8, ptr [[ALLOCA]], align 413; CHECK-NEXT:    [[LOAD_I32:%.*]] = load i32, ptr [[ALLOCA]], align 414; CHECK-NEXT:    store i8 [[X]], ptr [[ALLOCA]], align 415; CHECK-NEXT:    store i32 [[Y]], ptr [[ALLOCA]], align 416; CHECK-NEXT:    ret void17;18  %alloca = alloca i32, align 119 20  %load.i8 = load i8, ptr %alloca, align 121  %load.i32 = load i32, ptr %alloca, align 122 23  store i8 %x, ptr %alloca, align 124  store i32 %y, ptr %alloca, align 125 26  ret void27}28 29; ------------------------------------------------------------------------------30; Struct type31; ------------------------------------------------------------------------------32 33%struct.pair = type { { i32, i32 }, { i32, i32 } }34 35define void @alloca_struct(i32 %x) {36; CHECK-LABEL: define void @alloca_struct37; CHECK-SAME: (i32 [[X:%.*]]) {38; CHECK-NEXT:    [[ALLOCA_STRUCT:%.*]] = alloca [[STRUCT_PAIR:%.*]], align 839; CHECK-NEXT:    [[GEP_0:%.*]] = getelementptr [[STRUCT_PAIR]], ptr [[ALLOCA_STRUCT]], i64 0, i32 140; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr { i32, i32 }, ptr [[GEP_0]], i64 0, i32 141; CHECK-NEXT:    [[LOAD_2:%.*]] = load i32, ptr [[GEP_0]], align 842; CHECK-NEXT:    store i32 0, ptr [[GEP_0]], align 843; CHECK-NEXT:    [[LOAD_1:%.*]] = load i32, ptr [[GEP_1]], align 444; CHECK-NEXT:    store i32 0, ptr [[GEP_1]], align 445; CHECK-NEXT:    ret void46;47  %alloca.struct = alloca %struct.pair48 49  %gep.0 = getelementptr %struct.pair, ptr %alloca.struct, i64 0, i32 150  %gep.1 = getelementptr { i32, i32 }, ptr %gep.0, i64 0, i32 151 52  %load.2 = load i32, ptr %gep.0, align 153  store i32 0, ptr %gep.0, align 154 55  %load.1 = load i32, ptr %gep.1, align 156  store i32 0, ptr %gep.1, align 157 58  ret void59}60