[PATCH] D94381: [test] Add Clang side tests for -fdebug-info-for-profiling

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 12 12:27:42 PST 2021


MaskRay added inline comments.


================
Comment at: clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp:14-16
+// RUN: echo > %t.proftext
+// RUN: llvm-profdata merge %t.proftext -o %t.profdata
+// RUN: %clang_cc1 -emit-llvm -fno-legacy-pass-manager -fdebug-pass-manager -O1 -fprofile-instrument-use-path=%t.profdata -fdebug-info-for-profiling %s -o - 2>&1 | FileCheck %s --check-prefix=DISCR
----------------
dblaikie wrote:
> What's this test for? (I'd hesitate to add a test that has to run llvm-profdata and use that profile, etc) I guess it's a different codepath that sets up the pass pipeline for this case compared to the previous case?
Test that -fdebug-info-for-profiling affects both driver -fprofile-use (CC1 -fprofile-instrument-use-path) and  driver -fprofile-generate (CC1 -fprofile-instrument-path). IIUC: generate/use needs to have compatible flags so that their CFG is identical.

The profile reading pass will error on an invalid file (e.g. an empty file).

I hesitated a bit for the usage of llvm-profdata, but I searched for llvm-profdata and there are 20+ other tests using llvm-profdata so I believe it is fine.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94381/new/

https://reviews.llvm.org/D94381



More information about the cfe-commits mailing list