Skip to content

Rollup of 7 pull requests #145090

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

Closed
wants to merge 17 commits into from
Closed

Conversation

tgross35
Copy link
Contributor

@tgross35 tgross35 commented Aug 8, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

RalfJung and others added 17 commits July 23, 2025 08:32
LLVM21 fixed the new float types on a number of targets:

* SystemZ gained f16 support
  llvm/llvm-project#109164
* Hexagon now uses soft f16 to avoid recursion bugs
  llvm/llvm-project#130977
* Mips now correctly handles f128 (actually since LLVM20)
  llvm/llvm-project#117525
* f128 is now correctly aligned when passing the stack on x86
  llvm/llvm-project#138092

Thus, enable the types on relevant targets for LLVM > 21.0.0.

NVPTX also gained handling of f128 as a storage type, but it lacks
support for basic math operations so is still disabled here.
`TyCtxt::short_string` ensures that user visible type paths aren't overwhelming on the terminal output, and properly saves the long name to disk as a side-channel. We already use these throughout the compiler and have been using them as needed when users find cases where the output is verbose. This is a proactive search of some cases to use `short_string`.

We add support for shortening the path of "trait path only".

Every manual use of `short_string` is a bright marker that that error should be using structured diagnostics instead (as they have proper handling of long types without the maintainer having to think abou tthem).

When we don't actually print out a shortened type we don't need the "use `--verbose`" note.

On E0599 show type identity to avoid expanding the receiver's generic parameters.

Unify wording on `long_ty_path` everywhere.
This code does not hash HIR manually (and has not done so for some time); it
merely obtains a hash returned as part of `hir_owner_nodes`.
Use `tcx.short_string()` in more diagnostics

`TyCtxt::short_string` ensures that user visible type paths aren't overwhelming on the terminal output, and properly saves the long name to disk as a side-channel. We already use these throughout the compiler and have been using them as needed when users find cases where the output is verbose. This is a proactive search of some cases to use `short_string`.

We add support for shortening the path of "trait path only".

Every manual use of `short_string` is a bright marker that that error should be using structured diagnostics instead (as they have proper handling of long types without the maintainer having to think abou tthem).
atomicrmw on pointers: move integer-pointer cast hacks into backend

Conceptually, we want to have atomic operations on pointers of the form `fn atomic_add(ptr: *mut T, offset: usize, ...)`. However, LLVM does not directly support such operations (llvm/llvm-project#120837), so we have to cast the `offset` to a pointer somewhere.

This PR moves that hack into the LLVM backend, so that the standard library, intrinsic, and Miri all work with the conceptual operation we actually want. Hopefully, one day LLVM will gain a way to represent these operations without integer-pointer casts, and then the hack will disappear entirely.

Cc ``@nikic`` -- this is the best we can do right now, right?
Fixes rust-lang#134617
coverage: Extract HIR-related helper code out of the main module

This is a decent chunk of helper code with a narrow external interface (one function returning one struct), making it a good candidate to be extracted out of the main `rustc_mir_transform::coverage` module.

No functional changes.
Enable f16 and f128 on targets that were fixed in LLVM21

LLVM21 fixed the new float types on a number of targets:

* SystemZ gained f16 support  llvm/llvm-project#109164
* Hexagon now uses soft f16 to avoid recursion bugs  llvm/llvm-project#130977
* Mips now correctly handles f128 (actually since LLVM20) llvm/llvm-project#117525
* f128 is now correctly aligned when passing the stack on x86  llvm/llvm-project#138092

Thus, enable the types on relevant targets for LLVM > 21.0.0.

NVPTX also gained handling of f128 as a storage type, but it lacks support for basic math operations so is still disabled here.

try-job: dist-i586-gnu-i586-i686-musl
try-job: dist-i686-linux
try-job: dist-i686-msvc
try-job: dist-s390x-linux
try-job: dist-various-1
try-job: dist-various-2
try-job: dist-x86_64-linux
try-job: i686-gnu-1
try-job: i686-gnu-2
try-job: i686-msvc-1
try-job: i686-msvc-2
try-job: test-various
regression test for intrinsics may not inline properly on pclmulqdq

https://rust.godbolt.org/z/dWsa9ET99

Fixes rust-lang#139029
Escape diff strings in MIR dataflow graphviz

This uses `dot::escape_html` on diff strings so that `<` and `>` are properly escaped in MIR dataflow graphviz.

Previously the output could be malformed. For example, the graphviz for borrow check `MaybeInitializedPlaces` for the example in rust-lang#145032 contained an unescaped `Fork<'_>`.
…eyouxu

Fix cross-compilation of Cargo

Regressed in rust-lang#144303. I guess this wasn't seen in other `ToolTarget` tools, because they are more dependent on the compiler and are ~always built together with other stuff that also built the std, while Cargo is relatively self-contained.

Fixes: rust-lang#145059

r? `@jieyouxu`
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Aug 8, 2025
@tgross35
Copy link
Contributor Author

tgross35 commented Aug 8, 2025

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Aug 8, 2025

📌 Commit 47fab32 has been approved by tgross35

It is now in the queue for this repository.

@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 8, 2025
@bors
Copy link
Collaborator

bors commented Aug 8, 2025

⌛ Testing commit 47fab32 with merge 7205dc5...

bors added a commit that referenced this pull request Aug 8, 2025
Rollup of 7 pull requests

Successful merges:

 - #144039 (Use `tcx.short_string()` in more diagnostics)
 - #144192 (atomicrmw on pointers: move integer-pointer cast hacks into backend)
 - #144823 (coverage: Extract HIR-related helper code out of the main module)
 - #144987 (Enable f16 and f128 on targets that were fixed in LLVM21)
 - #145001 (regression test for intrinsics may not inline properly on pclmulqdq)
 - #145080 (Escape diff strings in MIR dataflow graphviz)
 - #145083 (Fix cross-compilation of Cargo)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-19-3 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [codegen] tests/codegen-llvm/zip.rs ... ok

failures:

---- [codegen] tests/codegen-llvm/pclmulqdq-target-feature-inlining.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-19/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/pclmulqdq-target-feature-inlining/pclmulqdq-target-feature-inlining.ll" "/checkout/tests/codegen-llvm/pclmulqdq-target-feature-inlining.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/pclmulqdq-target-feature-inlining.rs:19:15: error: CHECK-NOT: excluded string found in input
// CHECK-NOT: call
              ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/pclmulqdq-target-feature-inlining/pclmulqdq-target-feature-inlining.ll:20:34: note: found here
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none)
                                 ^~~~

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/pclmulqdq-target-feature-inlining/pclmulqdq-target-feature-inlining.ll
Check file: /checkout/tests/codegen-llvm/pclmulqdq-target-feature-inlining.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
        1: ; ModuleID = 'pclmulqdq_target_feature_inlining.9214cdb5468b9bc6-cgu.0' 
        2: source_filename = "pclmulqdq_target_feature_inlining.9214cdb5468b9bc6-cgu.0" 
        3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" 
        4: target triple = "x86_64-unknown-linux-gnu" 
        5:  
        6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(argmem: readwrite) uwtable 
        7: define void @reduce128_caller(ptr dead_on_unwind noalias nocapture noundef writable writeonly sret([16 x i8]) align 16 dereferenceable(16) %_0, ptr noalias nocapture noundef readonly align 16 dereferenceable(16) %a, ptr noalias nocapture noundef readonly align 16 dereferenceable(16) %b, ptr noalias nocapture noundef readonly align 16 dereferenceable(16) %keys) unnamed_addr #0 { 
        8: start: 
        9:  %0 = load <2 x i64>, ptr %a, align 16 
       10:  %1 = load <2 x i64>, ptr %b, align 16 
       11:  %2 = load <2 x i64>, ptr %keys, align 16 
       12:  %3 = tail call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> %0, <2 x i64> %2, i8 noundef zeroext 0) #2 
       13:  %4 = tail call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> %0, <2 x i64> %2, i8 noundef zeroext 17) #2 
       14:  %5 = xor <2 x i64> %3, %1 
       15:  %6 = xor <2 x i64> %5, %4 
       16:  store <2 x i64> %6, ptr %_0, align 16, !alias.scope !3, !noalias !8 
       17:  ret void 
       18: } 
       19:  
       20: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none) 
not:19                                      !~~~                                                     error: no match expected
       21: declare <2 x i64> @llvm.x86.pclmulqdq(<2 x i64>, <2 x i64>, i8 immarg) unnamed_addr #1 
       22:  
       23: attributes #0 = { mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(argmem: readwrite) uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" "target-features"="+pclmul,+sse,+sse2,+sse,+sse2,+sse,+sse2,+sse3,+sse4.1,+ssse3" } 
       24: attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(none) } 
       25: attributes #2 = { nounwind } 
       26:  
       27: !llvm.module.flags = !{!0, !1} 
       28: !llvm.ident = !{!2} 
       29:  
       30: !0 = !{i32 8, !"PIC Level", i32 2} 
       31: !1 = !{i32 2, !"RtLibUseGOT", i32 1} 
       32: !2 = !{!"rustc version 1.91.0-nightly (7205dc523 2025-08-08)"} 
       33: !3 = !{!4, !6} 
       34: !4 = distinct !{!4, !5, !"_ZN4core9core_arch3x864sse213_mm_xor_si12817hc7907fc0728c2eadE: %_0"} 
       35: !5 = distinct !{!5, !"_ZN4core9core_arch3x864sse213_mm_xor_si12817hc7907fc0728c2eadE"} 
       36: !6 = distinct !{!6, !7, !"_ZN33pclmulqdq_target_feature_inlining9reduce12817hc54471dbdcb72e40E: %_0"} 
       37: !7 = distinct !{!7, !"_ZN33pclmulqdq_target_feature_inlining9reduce12817hc54471dbdcb72e40E"} 
       38: !8 = !{!9, !10, !11, !12, !13} 
       39: !9 = distinct !{!9, !5, !"_ZN4core9core_arch3x864sse213_mm_xor_si12817hc7907fc0728c2eadE: %a"} 
       40: !10 = distinct !{!10, !5, !"_ZN4core9core_arch3x864sse213_mm_xor_si12817hc7907fc0728c2eadE: %b"} 
       41: !11 = distinct !{!11, !7, !"_ZN33pclmulqdq_target_feature_inlining9reduce12817hc54471dbdcb72e40E: %a"} 
       42: !12 = distinct !{!12, !7, !"_ZN33pclmulqdq_target_feature_inlining9reduce12817hc54471dbdcb72e40E: %b"} 
       43: !13 = distinct !{!13, !7, !"_ZN33pclmulqdq_target_feature_inlining9reduce12817hc54471dbdcb72e40E: %keys"} 
>>>>>>
------------------------------------------



@bors
Copy link
Collaborator

bors commented Aug 8, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 8, 2025
@tgross35 tgross35 closed this Aug 8, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 8, 2025
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. A-run-make Area: port run-make Makefiles to rmake.rs rollup A PR which is a rollup T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants