Skip to content

Conversation

@folkertdev
Copy link
Contributor

@folkertdev folkertdev commented Jan 30, 2026

fixes #97804

It appears that this issue was fixed silently in LLVM 19. The original codegen was terrible, but starting at LLVM 19 opt is able to generate good code.

https://llvm.godbolt.org/z/5vq8scP6q

cc @programmerjake

@folkertdev folkertdev added the A-SIMD Area: SIMD (Single Instruction Multiple Data) label Jan 30, 2026
@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 Jan 30, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 30, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
##[group]Runner Image Provisioner
Hosted Compute Agent
Version: 20260123.484
Commit: 6bd6555ca37d84114959e1c76d2c01448ff61c5d
Build Date: 2026-01-23T19:41:17Z
Worker ID: {0ca236c6-d616-4458-9b19-d95f3a937a03}
Azure Region: westcentralus
##[endgroup]
##[group]Operating System
Ubuntu
24.04.3
LTS
---
REPOSITORY                                   TAG       IMAGE ID       CREATED      SIZE
ghcr.io/dependabot/dependabot-updater-core   latest    bcec0b4e062b   4 days ago   783MB
=> Removing docker images...
Deleted Images:
untagged: ghcr.io/dependabot/dependabot-updater-core:latest
untagged: ghcr.io/dependabot/dependabot-updater-core@sha256:b662be51f7b8ef7e2c8464428f14e49cb79c36aa9afb7ecb9221dfe0f507050c
deleted: sha256:bcec0b4e062b5ffe11cc1c2729558c0cd96621c0271ab5e97ff3a56e0c25045a
deleted: sha256:64e147d5e54d9be8b8aa322e511cda02296eda4b8b8d063c6a314833aca50e29
deleted: sha256:5cba409bb463f4e7fa1a19f695450170422582c1bc7c0e934d893b4e5f558bc6
deleted: sha256:cddc6ebd344b0111eaab170ead1dfda24acdfe865ed8a12599a34d338fa8e28b
deleted: sha256:2412c3f334d79134573cd45e657fb6cc0abd75bef3881458b0d498d936545c8d
---
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap (line 72) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,RandomState>::new (line 264) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,RandomState>::from (line 1504) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,RandomState>::with_capacity (line 283) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::capacity (line 445) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::clear (line 819) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::contains_key (line 1220) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::drain (line 721) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::entry (line 959) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::extract_if (line 761) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::get (line 987) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::get_disjoint_mut (line 1119) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::get_disjoint_mut (line 1077) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::hasher (line 837) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::get_key_value (line 1017) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::get_disjoint_unchecked_mut (line 1162) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::get_mut (line 1247) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::insert (line 1280) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::into_iter (line 2053) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::into_keys (line 491) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::into_values (line 586) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::is_empty (line 698) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::iter (line 618) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::iter_mut (line 648) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::keys (line 461) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::len (line 681) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::remove (line 1339) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::reserve (line 870) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::remove_entry (line 1367) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::retain (line 792) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::shrink_to (line 937) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::shrink_to_fit (line 913) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::try_insert (line 1309) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::try_reserve (line 895) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S>::with_capacity_and_hasher (line 383) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::values (line 523) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S,A>::values_mut (line 552) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::HashMap<K,V,S>::with_hasher (line 351) ... ok
test library/std/src/collections/hash/map.rs - collections::hash::map::IntoValues (line 1877) ... ok
---
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,RandomState>::new (line 142) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,RandomState>::with_capacity (line 161) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::capacity (line 313) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,RandomState>::from (line 1180) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::clear (line 490) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::contains (line 758) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::drain (line 398) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::difference (line 630) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::entry (line 861) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::extract_if (line 434) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::get (line 783) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::get_or_insert (line 805) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::get_or_insert_with (line 829) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::hasher (line 508) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::insert (line 983) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::into_iter (line 1643) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::is_disjoint (line 903) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::intersection (line 697) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::is_empty (line 375) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::iter (line 329) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::is_superset (line 951) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::is_subset (line 929) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::len (line 357) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::reserve (line 541) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::remove (line 1030) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::replace (line 1004) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::retain (line 465) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::shrink_to (line 607) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::shrink_to_fit (line 584) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::symmetric_difference (line 660) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::take (line 1058) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::try_reserve (line 567) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S,A>::union (line 726) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S>::with_capacity_and_hasher (line 255) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::HashSet<T,S>::with_hasher (line 223) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::Intersection (line 1507) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::IntoIter (line 1422) ... ok
test library/std/src/collections/hash/set.rs - collections::hash::set::Iter (line 1392) ... ok
---

---- [codegen] tests/codegen-llvm/simd/array-repeat.rs stdout ----
------FileCheck stdout------------------------------

------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/simd/array-repeat.rs:16:17: error: CHECK-NEXT: expected string not found in input
 // CHECK-NEXT: %0 = insertelement <8 x i16> poison, i16 %v, i64 0
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/simd/array-repeat/array-repeat.ll:8:6: note: scanning from here
start:
     ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/simd/array-repeat/array-repeat.ll:10:23: note: possible intended match here
 %_5.sroa.4.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 2
                      ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/simd/array-repeat/array-repeat.ll
Check file: /checkout/tests/codegen-llvm/simd/array-repeat.rs

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

Input was:
<<<<<<
           1: ; ModuleID = 'array_repeat.57d4eb84faba7a8b-cgu.0' 
           2: source_filename = "array_repeat.57d4eb84faba7a8b-cgu.0" 
           3: target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20" 
           4: target triple = "wasm32-unknown-wasip1" 
           5:  
           6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 
           7: define dso_local void @foo(i16 noundef %v, ptr noalias noundef writeonly align 1 captures(none) dereferenceable(16) initializes((0, 16)) %p) unnamed_addr #0 { 
           8: start: 
next:16'0          X~ error: no match found
           9:  store i16 %v, ptr %p, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          10:  %_5.sroa.4.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 2 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:16'1                           ?                                                  possible intended match
          11:  store i16 %v, ptr %_5.sroa.4.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          12:  %_5.sroa.5.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 4 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          13:  store i16 %v, ptr %_5.sroa.5.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          14:  %_5.sroa.6.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 6 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          15:  store i16 %v, ptr %_5.sroa.6.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          16:  %_5.sroa.7.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 8 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          17:  store i16 %v, ptr %_5.sroa.7.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          18:  %_5.sroa.8.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 10 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          19:  store i16 %v, ptr %_5.sroa.8.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          20:  %_5.sroa.9.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 12 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          21:  store i16 %v, ptr %_5.sroa.9.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          22:  %_5.sroa.10.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 14 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          23:  store i16 %v, ptr %_5.sroa.10.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          24:  ret void 
next:16'0     ~~~~~~~~~~
          25: } 
next:16'0     ~~
          26:  
next:16'0     ~
          27: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) "target-cpu"="generic" } 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          28:  
next:16'0     ~
          29: !llvm.ident = !{!0} 
next:16'0     ~~~~~~~~~~~~~~~~~~~~
          30:  
next:16'0     ~
          31: !0 = !{!"rustc version 1.95.0-nightly (58a5550ab 2026-01-30)"} 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>

------------------------------------------

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/simd/array-repeat/array-repeat.ll" "/checkout/tests/codegen-llvm/simd/array-repeat.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/simd/array-repeat.rs:16:17: error: CHECK-NEXT: expected string not found in input
 // CHECK-NEXT: %0 = insertelement <8 x i16> poison, i16 %v, i64 0
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/simd/array-repeat/array-repeat.ll:8:6: note: scanning from here
start:
     ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/simd/array-repeat/array-repeat.ll:10:23: note: possible intended match here
 %_5.sroa.4.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 2
                      ^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/simd/array-repeat/array-repeat.ll
Check file: /checkout/tests/codegen-llvm/simd/array-repeat.rs

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

Input was:
<<<<<<
           1: ; ModuleID = 'array_repeat.57d4eb84faba7a8b-cgu.0' 
           2: source_filename = "array_repeat.57d4eb84faba7a8b-cgu.0" 
           3: target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20" 
           4: target triple = "wasm32-unknown-wasip1" 
           5:  
           6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 
           7: define dso_local void @foo(i16 noundef %v, ptr noalias noundef writeonly align 1 captures(none) dereferenceable(16) initializes((0, 16)) %p) unnamed_addr #0 { 
           8: start: 
next:16'0          X~ error: no match found
           9:  store i16 %v, ptr %p, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          10:  %_5.sroa.4.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 2 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:16'1                           ?                                                  possible intended match
          11:  store i16 %v, ptr %_5.sroa.4.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          12:  %_5.sroa.5.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 4 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          13:  store i16 %v, ptr %_5.sroa.5.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          14:  %_5.sroa.6.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 6 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          15:  store i16 %v, ptr %_5.sroa.6.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          16:  %_5.sroa.7.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 8 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          17:  store i16 %v, ptr %_5.sroa.7.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          18:  %_5.sroa.8.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 10 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          19:  store i16 %v, ptr %_5.sroa.8.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          20:  %_5.sroa.9.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 12 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          21:  store i16 %v, ptr %_5.sroa.9.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          22:  %_5.sroa.10.0.p.sroa_idx = getelementptr inbounds nuw i8, ptr %p, i32 14 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          23:  store i16 %v, ptr %_5.sroa.10.0.p.sroa_idx, align 1 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          24:  ret void 
next:16'0     ~~~~~~~~~~
          25: } 
next:16'0     ~~
          26:  
next:16'0     ~
          27: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) "target-cpu"="generic" } 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          28:  
next:16'0     ~
          29: !llvm.ident = !{!0} 
next:16'0     ~~~~~~~~~~~~~~~~~~~~
          30:  
next:16'0     ~
          31: !0 = !{!"rustc version 1.95.0-nightly (58a5550ab 2026-01-30)"} 
next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>
------------------------------------------

---- [codegen] tests/codegen-llvm/simd/array-repeat.rs stdout end ----

@folkertdev
Copy link
Contributor Author

folkertdev commented Jan 30, 2026

Hmm, it is fixed on x86_64 and aarch64, but not for other targets where vector types require a target feature.

  • for s390x it only optimizes when the vector target feature is available
  • for wasm32 even with +simd128 it does not optimize (should just be a splat I think?)

Do we consider that fixed?

@folkertdev
Copy link
Contributor Author

I did file llvm/llvm-project#178940 for the wasm issue, cc @nikic

@workingjubilee
Copy link
Member

workingjubilee commented Jan 30, 2026

For s390x without +vector, it probably comes from type legalization: LLVM, if it can't fit a type or operation with that type to a series of machine operations, will, during... lowering to SelectionDAG, I think?... "scalarize" the operations into operations on a valid type.

@folkertdev
Copy link
Contributor Author

I'm a bit out of my depth here, but I would expect the transformation to a vector splat to happen much earlier than that. You're right that it does appear use information about what types are legal for the current target though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-SIMD Area: SIMD (Single Instruction Multiple Data) 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Array Repeat operator should not use a loop for small sizes

6 participants