-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add CallModifier.never_intrinsify #21900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for taking a stab at this. Note that the linked issue is a proposal. This PR can't be merged until the proposal is accepted. Also, the attribute you want for this purpose is |
@mlugg maybe you can give some pointers for the Sema changes? |
23faba4
to
1138513
Compare
I was a bit confused by this message |
Have you verified that the resulting LLVM IR in fact contains Also compare pre-optimization ( |
Yes
This is If I understand correctly, there is no way to use |
I don't see anything wrong in that LLVM IR. It's retaining the |
1138513
to
2135543
Compare
But actually, I get this after disassembly.
(Those |
This looks like a call with a relocation. Try also passing |
I compared disassembly with
Moreover if I compare Also in
I don't much understand, how the relocation works, but I think, originally there were no recursive call. |
I think reproducing the original bug is a bit involved. For some reason, I was only able to do it with the |
Oh, yes, I forgot about With this when I don't use When I used it, I see |
Sounds like the change is working as intended then, if I understand your comment correctly. In that case, we just need to wait for the proposal to be considered by Andrew. |
@@ -5585,6 +5586,7 @@ pub const FuncGen = struct { | |||
switch (modifier) { | |||
.auto, .never_tail, .always_tail => {}, | |||
.never_inline => try attributes.addFnAttr(.@"noinline", &o.builder), | |||
.never_intrinsify => try attributes.addFnAttr(.nobuiltin, &o.builder), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the handling of never_intrinsify
will need to be combined with the code I added here: https://github.com/ziglang/zig/pull/21920/files#diff-4b7d5a9d78d51e4f41a41d80317e1ca360c16103d76b09c3dcb73ab3e4cc2d71R5579-R5581
closing in favor of #22110 |
issue
I attempted to implement this. The string attribute
no-builtins
is passed to llvm. (I checked it explicitly in this place.) However, there is still recursion in generated code. I doubt, if this attribute is implemented in llvm.Also, I don't much understand, what should I do in
Sema.zig
, and I don't know how to correctly bootstrap (note, that the fieldnever_intrinsify
is the last in the enum).