Skip to content

[clang] Simplify updating CodeGenOptions - #23214

Draft
hahnjo wants to merge 1 commit into
root-project:masterfrom
hahnjo:clang-StartModule-CGO
Draft

[clang] Simplify updating CodeGenOptions#23214
hahnjo wants to merge 1 commit into
root-project:masterfrom
hahnjo:clang-StartModule-CGO

Conversation

@hahnjo

@hahnjo hahnjo commented Sep 1, 2026

Copy link
Copy Markdown
Member

This works now since upstream commit llvm/llvm-project@ddeab07 changed the intentional copy in CodeGeneratorImpl to a reference with a single copy of the CodeGenOptions stored in the CompilerInvocation.

This reverts the downstream modifications from commit 0d60867, allowing to drop one more Clang patch.

This works now since upstream commit
llvm/llvm-project@ddeab07
changed the intentional copy in CodeGeneratorImpl to a reference with
a single copy of the CodeGenOptions stored in the CompilerInvocation.

This reverts the downstream modifications from commit 0d60867,
allowing to drop one more Clang patch.
@hahnjo
hahnjo requested review from aaronj0 and vgvassilev September 1, 2026 08:02
@hahnjo hahnjo self-assigned this Sep 1, 2026
@hahnjo hahnjo added the in:Cling label Sep 1, 2026
@vgvassilev

Copy link
Copy Markdown
Member

This very likely renders #pragma cling optimize (2) dysfunctional.

@hahnjo

hahnjo commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

This very likely renders #pragma cling optimize (2) dysfunctional.

No, it doesn't: there is a single CodeGenOptions that is updated in IncrementalParser::codeGenTransaction, see the commit message.

@vgvassilev

Copy link
Copy Markdown
Member

Assuming you checked, then LGTM!

@vgvassilev vgvassilev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@hahnjo

hahnjo commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

Assuming you checked, then LGTM!

Yes, I checked by inspecting the value of CodeGenOpts.OptimizationLevel in StartModule (without passing the updated options). However, I suspect that's actually too late for some code generation, see #23220. But that's already the case for master, unrelated to this change.

@vgvassilev

Copy link
Copy Markdown
Member

That's a silent regression introduced along the upgrades I guess. It is a pity that rootbench is good state to catch that and we never implemented adequate cling test...

@hahnjo

hahnjo commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

That's a silent regression introduced along the upgrades

Not a recent one, I can reproduce also with 6.26. To be honest, I would not be super surprised if this oversight is there since the feature was introduced. To be clear, the optimization level is respected for the majority of the compilation, such as the passes, but not (always) for generating the IR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants