[PATCH] D126984: [clang] Add support for optimize function attribute

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 14 08:41:37 PDT 2022


xbolva00 added a comment.

>> That's not stopped us from exposing attributes like minsize (and you proposed optsize as well) which get described in the same terms as -Os/-Oz in our documentation, so this ship has somewhat sailed.

Well, there is no promise that attribute matches -O flag in the documentation, indeed. But I understand your point and not a issue in practise.

>> Look here: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp and see lines (conditions) with SizeLevel and OptLevel.

Second look, I think it is possible to rework those lines to respect attributes more; like for example

  MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1, PrepareForLTO));

in such way, that in the pass itself, we would do something like OptionXYZ = F.isMinSize() ? 0 : -1;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126984



More information about the cfe-commits mailing list