Skip to content

Conversation

@Rexicon226
Copy link
Contributor

@Rexicon226 Rexicon226 commented Nov 7, 2025

closes #25840

reasoning for adding the extra clobbers:

zig/src/codegen/llvm.zig

Lines 7506 to 7509 in 40132af

// For some targets, Clang unconditionally adds some clobbers to all inline assembly.
// While this is probably not strictly necessary, if we don't follow Clang's lead
// here then we may risk tripping LLVM bugs since anything not used by Clang tends
// to be buggy and regress often.

the edx -> rdx switch matches what we do in the stdlib:

[_] "{rdx}" (default),

also makes sense since that's the x86-64 branch (prob was just copied)

This seems to work around a very puzzling miscompilation first
present in LLVM 21.x. We already unconditionally add these
clobbers to inline assembly that came from the source, the
valgrind requests should also contain them.
@Rexicon226 Rexicon226 changed the title llvm: clobber rdx instead of edx for x86-64 valgrind request llvm: fix up clobbers for valgrind requests Nov 7, 2025
@alexrp alexrp enabled auto-merge November 7, 2025 04:36
@alexrp alexrp merged commit 19af9fa into ziglang:master Nov 7, 2025
9 checks passed
@Rexicon226 Rexicon226 deleted the llvm-valgrind-clobber branch November 7, 2025 15:58
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.

Invalid elliptic curve field arithmetic with -femit-llvm-bc and >= -O1

2 participants