Skip to content

Fix loop-vectorizations being enabled by default with -Oz and -O1 - #5253

Open
kinke wants to merge 1 commit into
ldc-developers:masterfrom
kinke:fix5233
Open

Fix loop-vectorizations being enabled by default with -Oz and -O1#5253
kinke wants to merge 1 commit into
ldc-developers:masterfrom
kinke:fix5233

Conversation

@kinke

@kinke kinke commented Aug 4, 2026

Copy link
Copy Markdown
Member

And enable the SLP vectorizations with -Oz. Resolves #5233.

Also drop -vectorize-{loops,slp} inherited from LLVM, which conflict with our dedicated switches.

Comment thread gen/optimizer.cpp
pto.LoopVectorization =
!disableLoopVectorization && optLevelVal > 1 && sizeLevelVal < 2;
// SLP vectorizer enabled with -Oz
pto.SLPVectorization = !disableSLPVectorization && optLevelVal > 1;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Do we want the users to be able to enforce these optimizations, via -disable-…=false?

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.

seems pretty niche to me...

@kinke kinke changed the title Fix loop-vectorizations being enabled by default with -Oz Fix loop-vectorizations being enabled by default with -Oz and -O1 Aug 4, 2026
And enable the SLP vectorizations with -Oz. Resolves ldc-developers#5233.

Also drop `-vectorize-{loops,slp}` inherited from LLVM, which conflict
with our dedicated switches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loop vectorization is never gated by -O level (dead condition in getPipelineTuningOptions)

2 participants