1b1926f30STeresa Johnson // Test if memprof instrumentation and use pass are invoked. 2b1926f30STeresa Johnson // 3b1926f30STeresa Johnson // Instrumentation: 4b1926f30STeresa Johnson // Ensure Pass MemProfilerPass and ModuleMemProfilerPass are invoked. 5b1926f30STeresa Johnson // RUN: %clang_cc1 -O2 -fmemory-profile %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=INSTRUMENT 6b1926f30STeresa Johnson // INSTRUMENT: Running pass: MemProfilerPass on main 7b1926f30STeresa Johnson // INSTRUMENT: Running pass: ModuleMemProfilerPass on [module] 8b1926f30STeresa Johnson 9b1926f30STeresa Johnson // Avoid failures on big-endian systems that can't read the raw profile properly 10b1926f30STeresa Johnson // REQUIRES: x86_64-linux 11b1926f30STeresa Johnson 12b1926f30STeresa Johnson // TODO: Use text profile inputs once that is available for memprof. 13b1926f30STeresa Johnson // 14e99b5ad3SSnehasish Kumar // To update the inputs below, run Inputs/update_memprof_inputs.sh 15b1926f30STeresa Johnson // RUN: llvm-profdata merge %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdata 16b1926f30STeresa Johnson 17b1926f30STeresa Johnson // Profile use: 18b1926f30STeresa Johnson // Ensure Pass PGOInstrumentationUse is invoked with the memprof-only profile. 19*546ec641STeresa Johnson // RUN: %clang_cc1 -O2 -fmemory-profile-use=%t.memprofdata %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=USE 20*546ec641STeresa Johnson // USE: Running pass: MemProfUsePass on [module] 21b1926f30STeresa Johnson foo()22b1926f30STeresa Johnsonchar *foo() { 23b1926f30STeresa Johnson return new char[10]; 24b1926f30STeresa Johnson } main()25b1926f30STeresa Johnsonint main() { 26b1926f30STeresa Johnson char *a = foo(); 27b1926f30STeresa Johnson delete[] a; 28b1926f30STeresa Johnson return 0; 29b1926f30STeresa Johnson } 30