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

cg_llvm: Clean up FFI calls for setting module flags #132319

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

Zalathar
Copy link
Contributor

This is a combination of several inter-related changes to how module flags are set:

  • Remove some unnecessary code for setting an "LTOPostLink" flag, which has been obsolete since LLVM 17.
  • Define our own enum instead of relying on enum values defined by LLVM's unstable C++ API.
  • Use safe wrapper functions to set module flags, instead of direct unsafe calls.
  • Consistently pass pointer/length strings instead of C strings.
  • Remove or shrink some unsafe blocks.

This module flag was an internal detail of LLVM's optimization passes, and all
code involving it was removed in LLVM 17.

<llvm/llvm-project@200cc95>
- Don't rely on enum values defined by LLVM's C++ API
- Use safe wrapper functions instead of direct `unsafe` calls
- Consistently pass pointer/length strings instead of C strings
@rustbot
Copy link
Collaborator

rustbot commented Oct 29, 2024

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 29, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

This LGTM, thanks

@jieyouxu
Copy link
Member

r? jieyouxu

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 29, 2024

📌 Commit 8d2ed4f has been approved by jieyouxu

It is now in the queue for this repository.

@rustbot rustbot assigned jieyouxu and unassigned lcnr Oct 29, 2024
@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 Oct 29, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 29, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#131984 (Stabilize if_let_rescope)
 - rust-lang#132151 (Ensure that resume arg outlives region bound for coroutines)
 - rust-lang#132157 (Remove detail from label/note that is already available in other note)
 - rust-lang#132274 (Cleanup op lookup in HIR typeck)
 - rust-lang#132319 (cg_llvm: Clean up FFI calls for setting module flags)
 - rust-lang#132321 (xous: sync: remove `rustc_const_stable` attribute on Condvar and Mutex new())

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2707cd6 into rust-lang:master Oct 29, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Oct 29, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 29, 2024
Rollup merge of rust-lang#132319 - Zalathar:add-module-flag, r=jieyouxu

cg_llvm: Clean up FFI calls for setting module flags

This is a combination of several inter-related changes to how module flags are set:

- Remove some unnecessary code for setting an `"LTOPostLink"` flag, which has been obsolete since LLVM 17.
- Define our own enum instead of relying on enum values defined by LLVM's unstable C++ API.
- Use safe wrapper functions to set module flags, instead of direct `unsafe` calls.
- Consistently pass pointer/length strings instead of C strings.
- Remove or shrink some `unsafe` blocks.
@Zalathar Zalathar deleted the add-module-flag branch October 29, 2024 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants