Skip to content

Remove unnecessary masking when converting from Bool#60435

Merged
adienes merged 1 commit intoJuliaLang:masterfrom
jakobnissen:no_and
Dec 20, 2025
Merged

Remove unnecessary masking when converting from Bool#60435
adienes merged 1 commit intoJuliaLang:masterfrom
jakobnissen:no_and

Conversation

@jakobnissen
Copy link
Copy Markdown
Member

The masking & 1 was added to remove unused upper bits in Bools. However, since then, Julia have decided that constructing booleans with bitpatterns other than 0b0 and 0b1 is undefined behaviour, and codegen now inserts these masks when loading booleans from memory. Therefore, they are redundant.

See #60425

The masking `& 1` was added to remove unused upper bits in `Bool`s. However,
since then, Julia have decided that constructing booleans with bitpatterns
other than 0b0 and 0b1 is undefined behaviour, and codegen now inserts these
masks when loading booleans from memory. Therefore, they are redundant.
@oscardssmith
Copy link
Copy Markdown
Member

Does this run into issues of the same variety as #52189?

@oscardssmith oscardssmith added the performance Must go faster label Dec 19, 2025
@jakobnissen
Copy link
Copy Markdown
Member Author

jakobnissen commented Dec 19, 2025

@oscardssmith I don't know to be honest, but I would think they are different issues - by the time the code affected by this PR is running, it's already a Julian Bool so it should already be an i8 in the LLVM sense (if I understand correctly - which I'm not sure I do).

@jakobnissen
Copy link
Copy Markdown
Member Author

Welp, turns out it doesn't matter, because the and instruction is still inserted.

@oscardssmith
Copy link
Copy Markdown
Member

Right. so this PR is good, but only because Jameson is saving you.

@jakobnissen jakobnissen added the merge me PR is reviewed. Merge when all tests are passing label Dec 20, 2025
@adienes adienes merged commit a32911a into JuliaLang:master Dec 20, 2025
11 checks passed
@adienes adienes removed the merge me PR is reviewed. Merge when all tests are passing label Dec 20, 2025
@jakobnissen jakobnissen deleted the no_and branch January 20, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Must go faster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants