[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-06-14 Thread Stephen Long via Phabricator via cfe-commits
steplong updated this revision to Diff 436954. steplong edited the summary of this revision. steplong added a comment. - Change logic to only handle empty optimization list - Fixup doc and tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125723/n

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-06-14 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment. >> I would like to hear quite strong motivating words. From https://reviews.llvm.org/D127565, Aaron mentioned "we have > 400 semantic attributes already and the support matrix for their combinations is pretty bad. ". Yes, this is a real good motivation why to rework th

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-06-14 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment. In D125723#3547789 , @rnk wrote: > I think it's fine to implement this, but I wanted to share some of the > motivation for the current state of things. In our experience, the majority > of uses of pragma optimize were to work a

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-06-13 Thread Stephen Long via Phabricator via cfe-commits
steplong added inline comments. Comment at: clang/include/clang/Sema/Sema.h:768 + /// (i.e. `ModifyFnAttributeMSPragmaOptimze()` does nothing) + bool MSPragmaOptimizeIsOn = true; + This might be confusing. `ModifyFnAttributeMSPragmaOptimize()` adds optnone to

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-06-13 Thread Stephen Long via Phabricator via cfe-commits
steplong updated this revision to Diff 436476. steplong added a comment. - Parse the string in the pragma - Some of the tests should fail. I'll fix them up once D126984 looks good Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://revie

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-06-02 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D125723#3553705 , @rnk wrote: > In D125723#3553664 , @aaron.ballman > wrote: > >> In D125723#3550956 , @steplong >> wrote: >> >>> Appre

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-06-02 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment. In D125723#3553664 , @aaron.ballman wrote: > In D125723#3550956 , @steplong > wrote: > >> Appreciate the help! It's not clear to me how to go from the strings "Os", >> "foo1", "foo2", "foo3

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-06-02 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D125723#3550956 , @steplong wrote: > Appreciate the help! It's not clear to me how to go from the strings "Os", > "foo1", "foo2", "foo3" to adding "-Os -ffoo1 -ffoo2 -ffoo3" to the > compilation line for that function

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-06-01 Thread Stephen Long via Phabricator via cfe-commits
steplong added a comment. Appreciate the help! It's not clear to me how to go from the strings "Os", "foo1", "foo2", "foo3" to adding "-Os -ffoo1 -ffoo2 -ffoo3" to the compilation line for that function Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-05-31 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Sema/SemaAttr.cpp:1207-1213 + FD->addAttr(FramePointerAttr::CreateImplicit(Context, Kind)); +} + +void Sema::AddOptsize(FunctionDecl *FD, SourceLocation Loc) { + FD->dropAttr(); + OptimizeSizeAttr::Kind Kind = Optimize

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-05-31 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment. I think it's fine to implement this, but I wanted to share some of the motivation for the current state of things. In our experience, the majority of uses of pragma optimize were to work around MSVC compiler bugs. So, instead of honoring them, we felt it was best to ignore

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-05-31 Thread Stephen Long via Phabricator via cfe-commits
steplong added inline comments. Comment at: clang/lib/Sema/SemaAttr.cpp:1207-1213 + FD->addAttr(FramePointerAttr::CreateImplicit(Context, Kind)); +} + +void Sema::AddOptsize(FunctionDecl *FD, SourceLocation Loc) { + FD->dropAttr(); + OptimizeSizeAttr::Kind Kind = OptimizeSizeA

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-05-31 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Sema/SemaAttr.cpp:1207-1213 + FD->addAttr(FramePointerAttr::CreateImplicit(Context, Kind)); +} + +void Sema::AddOptsize(FunctionDecl *FD, SourceLocation Loc) { + FD->dropAttr(); + OptimizeSizeAttr::Kind Kind = Optimize

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-05-31 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Parse/ParsePragma.cpp:3662 + } + ExprResult StringResult = Parser::ParseStringLiteralExpression(); + if (StringResult.isInvalid()) Comment at: clang/lib/Parse/ParsePragma.cpp:3671

[PATCH] D125723: [MSVC] Add support for MSVC pragma optimize

2022-05-16 Thread Stephen Long via Phabricator via cfe-commits
steplong created this revision. Herald added a project: All. steplong requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. MSVC's pragma optimize turns optimizations on or off based on the list passed. Depends on D125722