Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / xray / TestCases / Posix / custom-event-handler-alignment.cpp
blob9c61cba83b0daf65139c02f37ed3f4af7792df60
1 // Make sure we're aligning the stack properly when lowering the custom event
2 // calls.
3 //
4 // RUN: %clangxx_xray -std=c++11 %s -o %t
5 // RUN: XRAY_OPTIONS="patch_premain=false verbosity=1" \
6 // RUN: %run %t 2>&1
7 // REQUIRES: x86_64-target-arch
8 // REQUIRES: built-in-llvm-tree
9 #include <xmmintrin.h>
10 #include <stdio.h>
11 #include "xray/xray_interface.h"
13 [[clang::xray_never_instrument]] __attribute__((weak)) __m128 f(__m128 *i) {
14 return *i;
17 [[clang::xray_always_instrument]] void foo() {
18 __xray_customevent(0, 0);
19 __m128 v = {};
20 f(&v);
23 [[clang::xray_always_instrument]] void bar() {
24 __xray_customevent(0, 0);
27 void printer(void* ptr, size_t size) {
28 printf("handler called\n");
29 __m128 v = {};
30 f(&v);
33 int main(int argc, char* argv[]) {
34 __xray_set_customevent_handler(printer);
35 __xray_patch();
36 foo(); // CHECK: handler called
37 bar(); // CHECK: handler called
38 __xray_unpatch();
39 __xray_remove_customevent_handler();
40 foo();
41 bar();