brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 42b0cbb Raw
53 lines · plain
1; RUN: opt -S -passes=sroa %s | FileCheck %s2; With fake use intrinsics generated for small aggregates, check that when3; SROA slices the aggregate, we generate individual fake use intrinsics for4; the individual values.5 6; Generated from the following source:7; struct s {8;   int i;9;   int j;10; };11;12; void foo(struct s S) {13; }14;15; void bar() {16;   int arr[2] = {5, 6};17; }18;19%struct.s = type { i32, i32 }20@__const.bar.arr = private unnamed_addr constant [2 x i32] [i32 5, i32 6], align 421 22; A small struct passed as parameter23; CHECK-LABEL: define{{.*}}foo24; CHECK:       %[[SLICE1:[^ ]+]] = trunc i6425; CHECK:       %[[SLICE2:[^ ]+]] = trunc i6426; CHECK-DAG:   call{{.*}} @llvm.fake.use(i32 %[[SLICE1]])27; CHECK-DAG:   call{{.*}} @llvm.fake.use(i32 %[[SLICE2]])28define dso_local void @foo(i64 %S.coerce) optdebug {29entry:30  %S = alloca %struct.s, align 431  store i64 %S.coerce, ptr %S, align 432  %fake.use = load %struct.s, ptr %S, align 433  notail call void (...) @llvm.fake.use(%struct.s %fake.use)34  ret void35}36 37; A local variable with a small array type.38; CHECK-LABEL: define{{.*}}bar39; CHECK:       %[[ARRAYSLICE1:[^ ]+]] = load40; CHECK:       %[[ARRAYSLICE2:[^ ]+]] = load41; CHECK-DAG:   call{{.*}} @llvm.fake.use(i32 %[[ARRAYSLICE1]])42; CHECK-DAG:   call{{.*}} @llvm.fake.use(i32 %[[ARRAYSLICE2]])43define dso_local void @bar() optdebug {44entry:45  %arr = alloca [2 x i32], align 446  call void @llvm.memcpy.p0i8.p0i8.i64(ptr align 4 %arr, ptr align 4 bitcast (ptr @__const.bar.arr to ptr), i64 8, i1 false)47  %fake.use = load [2 x i32], ptr %arr, align 448  notail call void (...) @llvm.fake.use([2 x i32] %fake.use)49  ret void50}51 52declare void @llvm.memcpy.p0i8.p0i8.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg)53