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

Fixes for LLVM change 0f45c16f2caa7c035e5c3edd40af9e0d51ad6ba7 #88289

Merged
merged 1 commit into from
Aug 27, 2021

Conversation

durin42
Copy link
Contributor

@durin42 durin42 commented Aug 24, 2021

More details in the individual commit messages, but the summary is: LLVM deleted an unused-to-them method that we used, we worked around it to avoid annoying cleanup/restructuring in the Rust-side code.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jackh726 (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 24, 2021
@nikic
Copy link
Contributor

nikic commented Aug 24, 2021

I think the right way now would be use lower-level APIs, something like this:

AttributeList AL = F->getAttributes();
AL = AL.addAttributes(F->getContext(), Index, B);
F->setAttributes(AL);

@aeubanks Does that sound right?

@aeubanks
Copy link
Contributor

These all look like single attributes, is an AttrBuilder necessary? Can you just directly create and add an Attribute?

@nikic
Copy link
Contributor

nikic commented Aug 24, 2021

@aeubanks Good point, I missed that. Yes, it should be possible to use APIs like Attribute::getWithDereferenceableBytes() to get the Attribute and add that.

@inquisitivecrystal inquisitivecrystal added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 24, 2021
@durin42
Copy link
Contributor Author

durin42 commented Aug 25, 2021

Alright, I believe I've cleaned this up to use all the right APIs. I'm a little dubious of the one static_cast<uint64_t> I had to use, and there's only one callsite in the Rust code, so maybe that code should be doing as u64 instead of as u32? Let me know if you want me to fix that too.

@jackh726
Copy link
Member

r? @nikic

@rust-highfive rust-highfive assigned nikic and unassigned jackh726 Aug 25, 2021
@aeubanks
Copy link
Contributor

I don't think you need the #ifdefs, you should be able to use the newly suggested method even with older versions of LLVM. It's cleaner anyway.

@durin42
Copy link
Contributor Author

durin42 commented Aug 25, 2021

Dropped the ifdefs, verified everything works on LLVM HEAD. I assume the bots will cover the older versions of LLVM in case I messed something up.

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

Looks good! Could you please squash the commits?

@durin42
Copy link
Contributor Author

durin42 commented Aug 25, 2021

Squashed. Thanks!

@nikic
Copy link
Contributor

nikic commented Aug 25, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 25, 2021

📌 Commit f751e2554dffe583d1c525ca5a3a28bf81a65d67 has been approved by nikic

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 25, 2021
@nikic
Copy link
Contributor

nikic commented Aug 26, 2021

@bors r- per Arthur's comment above

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 26, 2021
The above-mentioned commit (part of the LLVM 14 development cycle)
removes a method that rustc uses somewhat extensively. We mostly switch
to lower-level methods that exist in all versions of LLVM we use, so no
new ifdef logic is required in most cases.
@durin42
Copy link
Contributor Author

durin42 commented Aug 26, 2021

PTAL - this should be ready

@nikic
Copy link
Contributor

nikic commented Aug 26, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Aug 26, 2021

📌 Commit 027db5d has been approved by nikic

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 26, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Aug 26, 2021
Fixes for LLVM change 0f45c16

More details in the individual commit messages, but the summary is: LLVM deleted an unused-to-them method that we used, we worked around it to avoid annoying cleanup/restructuring in the Rust-side code.
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 27, 2021
…arth

Rollup of 11 pull requests

Successful merges:

 - rust-lang#87832 (Fix debugger stepping behavior with `match` expressions)
 - rust-lang#88123 (Make spans for tuple patterns in E0023 more precise)
 - rust-lang#88215 (Reland rust-lang#83738: "rustdoc: Don't load all extern crates unconditionally")
 - rust-lang#88216 (Don't stabilize creation of TryReserveError instances)
 - rust-lang#88270 (Handle type ascription type ops in NLL HRTB diagnostics)
 - rust-lang#88289 (Fixes for LLVM change 0f45c16)
 - rust-lang#88320 (type_implements_trait consider obligation failure on overflow)
 - rust-lang#88332 (Add argument types tait tests)
 - rust-lang#88340 (Add `c_size_t` and `c_ssize_t` to `std::os::raw`.)
 - rust-lang#88346 (Revert "Add type of a let tait test impl trait straight in let")
 - rust-lang#88348 (Add field types tait tests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit dfca7b3 into rust-lang:master Aug 27, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 27, 2021
@durin42 durin42 deleted the llvm-14-attrs branch September 7, 2021 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants