Commit ec4373b
committed
[InstCombine] Fold bitcast (extelt (bitcast X), Idx) into bitcast+shuffle.
Fold sequences such as:
```llvm
%bc = bitcast <8 x i32> %v to <2 x i128>
%ext = extractelement <2 x i128> %bc, i64 0
%res = bitcast i128 %ext to <2 x i64>
```
Into:
```llvm
%bc = bitcast <8 x i32> %v to <4 x i64>
%res = shufflevector <4 x i64> %bc, <4 x i64> poison, <2 x i32> <i32 0, i32 1>
```
The motivation for this is a long standing regression affecting SIMDe on
AArch64 introduced indirectly by the AlwaysInliner (1a2e77c). Some
reproducers:
* https://godbolt.org/z/53qx18s6M
* https://godbolt.org/z/o5e43h5M71 parent 13aae75 commit ec4373b
File tree
2 files changed
+52
-6
lines changed- llvm
- lib/Transforms/InstCombine
- test/Transforms/InstCombine
2 files changed
+52
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2380 | 2380 | | |
2381 | 2381 | | |
2382 | 2382 | | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
2383 | 2428 | | |
2384 | 2429 | | |
2385 | 2430 | | |
| |||
2866 | 2911 | | |
2867 | 2912 | | |
2868 | 2913 | | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
2869 | 2917 | | |
2870 | 2918 | | |
2871 | 2919 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
487 | | - | |
488 | | - | |
489 | | - | |
| 487 | + | |
| 488 | + | |
490 | 489 | | |
491 | 490 | | |
492 | 491 | | |
| |||
499 | 498 | | |
500 | 499 | | |
501 | 500 | | |
502 | | - | |
503 | | - | |
504 | | - | |
| 501 | + | |
| 502 | + | |
505 | 503 | | |
506 | 504 | | |
507 | 505 | | |
| |||
0 commit comments