Debian Codegraph @

clang/test/CodeGen/fake-use-scalar.c

raw
1 // RUN: %clang_cc1 %s -emit-llvm -fextend-variable-liveness -o - | FileCheck %s --implicit-check-not=fake.use
2 // Make sure we don't generate fake.use for non-scalar variables, unless they
3 // are small enough that they may be represented as a scalar in LLVM IR.
4 // Make sure we don't generate fake.use for volatile variables
5 // and parameters even when they are scalar.
6
7 struct BigAggr {
8 unsigned long t;
9 char c[1024];
10 unsigned char r[32];
11 };
12
13 struct SmallAggr {
14 int i;
15 int j;
16 };
17
18 int foo(volatile int vol_param, int param)
19 {
20 struct BigAggr big;
21 struct SmallAggr small;
22 volatile int vol_local;
23 int local;
24 unsigned long_arr[5];
25 unsigned short_arr[4];
26 return 0;
27 }
28
29 // CHECK: [[SMALL_ARR_FAKE_USE:%.+]] = load [4 x i[[#UINT_SIZE:]]], ptr %short_arr
30 // CHECK: call void (...) @llvm.fake.use([4 x i[[#UINT_SIZE]]] [[SMALL_ARR_FAKE_USE]])
31
32 // CHECK: [[LOCAL_FAKE_USE:%.+]] = load i32, ptr %local
33 // CHECK: call void (...) @llvm.fake.use(i32 [[LOCAL_FAKE_USE]])
34
35 // CHECK: [[SMALL_FAKE_USE:%.+]] = load %struct.SmallAggr, ptr %small
36 // CHECK: call void (...) @llvm.fake.use(%struct.SmallAggr [[SMALL_FAKE_USE]])
37
38 // CHECK: [[PARAM_FAKE_USE:%.+]] = load i32, ptr %param.addr
39 // CHECK: call void (...) @llvm.fake.use(i32 [[PARAM_FAKE_USE]])
40
41 // CHECK: declare void @llvm.fake.use