[PATCH] D79916: Map -O to -O1 instead of -O2

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 17 12:09:19 PDT 2020


MaskRay added a comment.

Several previous comments are FreeBSD specific. To we clang developers, the concrete request is

> Given that GCC will inline at -O, at least these days, ...

right? I think this makes sense, especially when `inline` is explicitly specified... This appears to be related to some -O1 work @echristo is working on.

  // gcc -O1 and g++ -O1 inline `foo`. Note that in C99 mode, `extern int foo` is needed to ask the compiler to provide an external definition.
  // clang -O1 and clang++ -O1 do not inline `foo`
  inline int foo(int a) {
    return a + a;
  }
  
  int bar(int a, int b) {
    return foo(a + b);
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79916



More information about the cfe-commits mailing list