[PATCH] D74698: [CodeGen] -pg shouldn't unconditionally add "frame-pointer"="all" fn attr w/ -mfentry

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 18 14:07:45 PST 2020


MaskRay added inline comments.


================
Comment at: clang/test/Driver/mfentry.c:5
+// RUN: %clang -pg -mfentry -O0 -emit-llvm -S -o - %s | FileCheck -check-prefix=FP --implicit-check-not='"frame-pointer"="none"' %s
+// RUN: %clang -pg -mfentry -O2 -fno-omit-frame-pointer -emit-llvm -S -o - %s | FileCheck -check-prefix=FP --implicit-check-not='"frame-pointer"="none"' %s
+// RUN: %clang -pg -mfentry -O2 -emit-llvm -S -o - %s | FileCheck -check-prefix=NOFP --implicit-check-not='"frame-pointer"="all"' %s
----------------
nickdesaulniers wrote:
> MaskRay wrote:
> > Change `-emit-llvm` to `-###` and delete `--implicit-check-not`. And add `-target x86_64`, because some targets don't support `-mfentry`.
> > 
> > For IR output, there can be multiple `"frame-pointer"="all"` function attributes. `--implicit-check-not` helps detect undesired attributes.
> > 
> > For cc1 options, there can't be multiple "frame-pointer" options. So `--implicit-check-not` is not useful.
> `-target x86_64` seems like a good idea, but `-###` produces:
> 
> ```
> clang-10: warning: argument unused during compilation: '-pg' [-Wunused-command-line-argument]
> clang-10: warning: argument unused during compilation: '-O2' [-Wunused-command-line-argument]
> clang-10: warning: argument unused during compilation: '-mfentry' [-Wunused-command-line-argument]
> ```
> so I don't think we want that. Or am I "holding it wrong?"
It works fine here.

Did you add some other unrelated options during testing? You can drop `-o -` by the way.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74698





More information about the cfe-commits mailing list