[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

Peter Collingbourne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 13 18:33:02 PDT 2017

pcc added a comment.

In https://reviews.llvm.org/D30920#700077, @tejohnson wrote:

> Until everything is converted to using size attributes, it seems like a correct fix for the bug is to accept these options in the gold-plugin and pass through the LTO API to the PassManagerBuilder.

Not necessarily. There is no requirement (from a correctness perspective) that `-Os` at link time should exactly match the behaviour of `-Os` at compile time.

Comment at: lib/Driver/ToolChains/CommonArgs.cpp:375
+      // They are captured by corresponding function attributes.
+      if (!OptLevel.equals("s") && !OptLevel.equals("z"))
+        OOpt = OptLevel;
This can just be `OptLevel != "s"` etc.

Comment at: test/Driver/gold-lto.c:33
+// RUN:     | FileCheck %s --implicit-check-not "-plugin-opt=Os"
+// RUN: %clang -### %t.o -flto -Os 2>&1 \
+// RUN:     | FileCheck %s --implicit-check-not "-plugin-opt=Oz"
`-Oz` here.


More information about the cfe-commits mailing list