mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-21 04:25:45 -04:00

Commit c15aa241f8
("[CLANG][BPF] change __builtin_preserve_access_index()
signature") changed the builtin function signature to
PointerT __builtin_preserve_access_index(PointerT ptr)
with a pointer type as the argument/return type, where argument and
return types must be the same.
There is really no reason for this constraint. The builtin just
presented a code region so that IR builtins
__builtin_{array, struct, union}_preserve_access_index
can be applied.
This patch removed the pointer type restriction to permit any
argument type as long as it is permitted by the compiler.
Differential Revision: https://reviews.llvm.org/D67883
llvm-svn: 372516
19 lines
778 B
C
19 lines
778 B
C
// RUN: %clang -target x86_64 -emit-llvm -S -g %s -o - | FileCheck %s
|
|
|
|
#define _(x) (__builtin_preserve_access_index(x))
|
|
|
|
struct s1 {
|
|
char a;
|
|
int b[4];
|
|
};
|
|
|
|
int unit1(struct s1 *arg) {
|
|
return _(arg->b[2]);
|
|
}
|
|
// CHECK: define dso_local i32 @unit1
|
|
// CHECK: call [4 x i32]* @llvm.preserve.struct.access.index.p0a4i32.p0s_struct.s1s(%struct.s1* %{{[0-9a-z]+}}, i32 1, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[STRUCT_S1:[0-9]+]]
|
|
// CHECK: call i32* @llvm.preserve.array.access.index.p0i32.p0a4i32([4 x i32]* %{{[0-9a-z]+}}, i32 1, i32 2), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[ARRAY:[0-9]+]]
|
|
//
|
|
// CHECK: ![[ARRAY]] = !DICompositeType(tag: DW_TAG_array_type
|
|
// CHECK: ![[STRUCT_S1]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s1"
|