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

Compatibility fixes for LLVM 3.5 #21588

Closed
wants to merge 3 commits into from

Conversation

lucab
Copy link
Contributor

@lucab lucab commented Jan 24, 2015

This fixes building with a system-installed LLVM 3.5 and also closes #20010

This commit introduce a third parameter for compatible_ifn!, as new
intrinsics are being added in recent LLVM releases and there is no
need to hardcode a specific case.

Signed-off-by: Luca Bruno <[email protected]>
@rust-highfive
Copy link
Collaborator

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

compatible_ifn!("llvm.copysign.f64", copysign(t_f64, t_f64) -> t_f64, 4);
compatible_ifn!("llvm.round.f32", roundf(t_f32) -> t_f32, 4);
compatible_ifn!("llvm.round.f64", round(t_f64) -> t_f64, 4);
compatible_ifn!("llvm.assume", fn(i1) -> void, 6);
Copy link
Member

Choose a reason for hiding this comment

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

I suspect this isn't quite right, unfortunately; it seems like it might be declaring a substitute C function with signature void fn(i1). (I.e. the compatible_ifn! macro has a different syntax.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, ouch sorry. I didn't notice the difference in what the two macros expect as the second parameter.

@lucab
Copy link
Contributor Author

lucab commented Jan 24, 2015

In turn, this seems to trigger an assertion in libstd/hash when building stage2 libcore: https://gist.github.com/lucab/8302e6ef7f88827fb093

I was inclined to blame myself for something I've forgotten to touch, but it looks like the same ICE already surfaced before in #2235, so I am a bit unsure...

@alexcrichton
Copy link
Member

Hm well the ICE may be related to some odd LLVM different, but we can probably diagnose after this lands, this is definitely good to land for now. Thanks!

@alexcrichton
Copy link
Member

@bors: r+ f85e825 rollup

@lucab
Copy link
Contributor Author

lucab commented Jan 24, 2015

Ok, I'll open a separate ticket for the ICE then, thanks.

EngineBuilder signature has changed in LLVM 3.6, as the interface
was not move-based in previous releases.

Signed-off-by: Luca Bruno <[email protected]>
@lucab
Copy link
Contributor Author

lucab commented Jan 26, 2015

Mmmh, however I just realized that my fix was incomplete/incorrect as I was mapping "llvm.assume" to a non-existing "void assume(bool)" C function. Rebased a commit to introduce a stub function. However, in the ligth of #21620, I wonder if merging this PR makes sense anymore.

@alexcrichton
Copy link
Member

Hm we'd probably prefer to lower it to a noop instead of a call to an actual function (as that may end up hindering optimizations). You've got a good point about #21620 though, so I think for now we can just close in favor of that. Thanks for investigating though!

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.

Rust requires llvm.assume intrinsic and hence LLVM 3.6
5 participants