Skip to content
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

Start letting through some more LLVM intrinsics disguised as calls #1565

Closed
wants to merge 3 commits into from

Conversation

ltratt
Copy link
Contributor

@ltratt ltratt commented Jan 26, 2025

Some of these are no-ops (c42bc99), some require codegen (e3f549d).

This is effectively an IR intrinsic, but is encoded as a call.
@@ -1503,6 +1503,11 @@ impl<'a> Assemble<'a> {
"llvm.assume" => Ok(()),
"llvm.lifetime.start.p0" => Ok(()),
"llvm.lifetime.end.p0" => Ok(()),
x if x.starts_with("llvm.smax") => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know for sure that llvm.smax is never inlined at the MIR level?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see no evidence of that, but really it's beyond my purview.

Copy link
Contributor

Choose a reason for hiding this comment

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

The problem is, if an intrinsic is inlined at the codegen level, then we trace the inlined version and then call it a second time.

That's probably OK (if a little iffy) for an operation like smax, but you certainly don't want to do that for operations that are expensive (in terms of performance, since you would incur the cost twice) or have side effects (which would break program semantics).

I'd like to hear what @ptersilie thinks, but my gut feeling is to not merge this until we have a better way of knowing whether an intrinsic has been inlined or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not merging this means that we are not compiling a surprising amount of traces: I have an extension of this PR that implements another one of these (ctpop) that triggers a bug (not, I'm about 95% sure, because of ctpop) that has been hidden because of all the traces we fail to compile.

@vext01
Copy link
Contributor

vext01 commented Jan 27, 2025

We had an offline discussion and think this is safe.

@vext01 vext01 added this pull request to the merge queue Jan 27, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 27, 2025
@ltratt
Copy link
Contributor Author

ltratt commented Jan 27, 2025

I currently cannot replicate this. Shall we retry?

@vext01 vext01 added this pull request to the merge queue Jan 27, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 27, 2025
@ltratt
Copy link
Contributor Author

ltratt commented Feb 6, 2025

Closing this as so much has changed elsewhere that this PR needed redoing from scratch.

@ltratt ltratt closed this Feb 6, 2025
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.

2 participants