Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / memprof / TestCases / memprof_merge_mib.cpp
blobee7f1ad26628b42d51dcf9bb97aa9d8c1fd3a5f6
1 // RUN: %clangxx_memprof %s -o %t
3 // RUN: %env_memprof_opts=print_text=true:log_path=stdout %run %t | FileCheck %s
5 #include <sanitizer/memprof_interface.h>
6 #include <stdlib.h>
7 #include <string.h>
8 int main(int argc, char **argv) {
9 for (int i = 0; i < 3; i++) {
10 char *x = (char *)malloc(10);
11 if (i % 2)
12 memset(x, 0, 10);
13 else
14 memset(x, 2, 10);
15 free(x);
17 return 0;
19 // We should get one allocation site with alloc_count = loop trip count = 3
20 // CHECK: Memory allocation stack id = [[ID:[0-9]+]]
21 // CHECK-NEXT-COUNT-1: alloc_count 3
22 // CHECK-COUNT-1: Stack for id {{.*}}[[ID]]
23 // CHECK-NEXT-COUNT-1: memprof_malloc_linux.cpp
24 // CHECK-NEXT-COUNT-1: memprof_merge_mib.cpp