Files
TheRock/compiler/amd-llvm/compiler-rt/test/metadata/uar.cpp
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

117 lines
3.8 KiB
C++

// RUN: %clangxx %s -O1 -o %t -fexperimental-sanitize-metadata=covered,uar && %t | FileCheck %s
// RUN: %clangxx %s -O1 -o %t -fexperimental-sanitize-metadata=covered,uar -fsanitize=address,signed-integer-overflow,alignment && %t | FileCheck %s
// RUN: %clangxx %s -O1 -o %t -mcmodel=large -fexperimental-sanitize-metadata=covered,uar -fsanitize=address,signed-integer-overflow,alignment && %t | FileCheck %s
// CHECK-DAG: metadata add version 2
__attribute__((noinline, not_tail_called)) void escape(const volatile void *p) {
[[maybe_unused]] static const volatile void *sink;
sink = p;
}
__attribute__((noinline, not_tail_called)) void use(int x) {
static volatile int sink;
sink += x;
}
// CHECK-DAG: empty: features=0 stack_args=0
void empty() {}
// CHECK-DAG: simple: features=0 stack_args=0
int simple(int *data, int index) { return data[index + 1]; }
// CHECK-DAG: builtins: features=0 stack_args=0
int builtins() {
int x = 0;
__builtin_prefetch(&x);
return x;
}
// CHECK-DAG: ellipsis: features=0 stack_args=0
void ellipsis(const char *fmt, ...) {
int x;
escape(&x);
}
// CHECK-DAG: non_empty_function: features=2 stack_args=0
void non_empty_function() {
int x;
escape(&x);
}
// CHECK-DAG: no_stack_args: features=2 stack_args=0
void no_stack_args(long a0, long a1, long a2, long a3, long a4, long a5) {
int x;
escape(&x);
}
// CHECK-DAG: stack_args: features=6 stack_args=16
void stack_args(long a0, long a1, long a2, long a3, long a4, long a5, long a6) {
int x;
escape(&x);
}
// CHECK-DAG: more_stack_args: features=6 stack_args=32
void more_stack_args(long a0, long a1, long a2, long a3, long a4, long a5,
long a6, long a7, long a8) {
int x;
escape(&x);
}
// CHECK-DAG: struct_stack_args: features=6 stack_args=144
struct large {
char x[131];
};
void struct_stack_args(large a) {
int x;
escape(&x);
}
__attribute__((noinline)) int tail_called(int x) { return x; }
// CHECK-DAG: with_tail_call: features=2
int with_tail_call(int x) { [[clang::musttail]] return tail_called(x); }
__attribute__((noinline, noreturn)) int noreturn(int x) { __builtin_trap(); }
// CHECK-DAG: with_noreturn_tail_call: features=0
int with_noreturn_tail_call(int x) { return noreturn(x); }
// CHECK-DAG: local_array: features=0
void local_array(int x) {
int data[10];
use(data[x]);
}
// CHECK-DAG: local_alloca: features=0
void local_alloca(int size, int i, int j) {
volatile int *p = static_cast<int *>(__builtin_alloca(size));
p[i] = 0;
use(p[j]);
}
// CHECK-DAG: escaping_alloca: features=2
void escaping_alloca(int size, int i) {
volatile int *p = static_cast<int *>(__builtin_alloca(size));
escape(&p[i]);
}
#define FUNCTIONS \
FN(empty); \
FN(simple); \
FN(builtins); \
FN(ellipsis); \
FN(non_empty_function); \
FN(no_stack_args); \
FN(stack_args); \
FN(more_stack_args); \
FN(struct_stack_args); \
FN(with_tail_call); \
FN(with_noreturn_tail_call); \
FN(local_array); \
FN(local_alloca); \
FN(escaping_alloca); \
/**/
#include "common.h"