Commit 28e62bf
committed
[InstCombine] Simple store-to-load forwaring between fixed/scalable vectors
When storing a scalable vector and the VScale is a compile-time known
constant, do basic store-to-load forwarding through @llvm.vector.insert
calls, even if the loaded vector is fixed-sized instead of scalable.
The @llvm.vector.insert is matched instead of the load itself because it
is
invalid to create a temporary insert of a scalable vector (the stored
value) into a fixed-sized vector (the load type).
The usecase is shown in this [godbold
link](https://godbolt.org/z/KT3sMrMbd), which shows that clang generates
IR that matches this pattern when the "arm_sve_vector_bits" attribute is
used:
```
typedef svfloat32_t svfloat32_fixed_t
__attribute__((arm_sve_vector_bits(512)));
struct svfloat32_wrapped_t {
svfloat32_fixed_t v;
};
static inline svfloat32_wrapped_t
add(svfloat32_wrapped_t a, svfloat32_wrapped_t b) {
return {svadd_f32_x(svptrue_b32(), a.v, b.v)};
}
svfloat32_wrapped_t
foo(svfloat32_wrapped_t a, svfloat32_wrapped_t b) {
// The IR pattern this patch matches is generated for this return:
return add(a, b);
}
```1 parent 091c45d commit 28e62bf
File tree
4 files changed
+57
-19
lines changed- llvm
- include/llvm/Analysis
- lib
- Analysis
- Transforms/InstCombine
- test/Transforms/InstCombine
4 files changed
+57
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
157 | 160 | | |
158 | 161 | | |
| 162 | + | |
159 | 163 | | |
160 | 164 | | |
161 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
541 | | - | |
| 541 | + | |
| 542 | + | |
542 | 543 | | |
543 | 544 | | |
544 | 545 | | |
| |||
584 | 585 | | |
585 | 586 | | |
586 | 587 | | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
587 | 607 | | |
588 | 608 | | |
589 | 609 | | |
| |||
655 | 675 | | |
656 | 676 | | |
657 | 677 | | |
658 | | - | |
659 | | - | |
| 678 | + | |
| 679 | + | |
660 | 680 | | |
661 | 681 | | |
662 | 682 | | |
| |||
711 | 731 | | |
712 | 732 | | |
713 | 733 | | |
714 | | - | |
| 734 | + | |
715 | 735 | | |
716 | 736 | | |
717 | 737 | | |
| |||
734 | 754 | | |
735 | 755 | | |
736 | 756 | | |
737 | | - | |
738 | | - | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
739 | 760 | | |
740 | 761 | | |
741 | 762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3389 | 3389 | | |
3390 | 3390 | | |
3391 | 3391 | | |
3392 | | - | |
3393 | | - | |
3394 | | - | |
| 3392 | + | |
| 3393 | + | |
| 3394 | + | |
| 3395 | + | |
| 3396 | + | |
| 3397 | + | |
| 3398 | + | |
| 3399 | + | |
| 3400 | + | |
| 3401 | + | |
| 3402 | + | |
| 3403 | + | |
| 3404 | + | |
| 3405 | + | |
| 3406 | + | |
| 3407 | + | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
3395 | 3412 | | |
3396 | 3413 | | |
3397 | 3414 | | |
3398 | | - | |
3399 | | - | |
3400 | | - | |
3401 | | - | |
3402 | | - | |
| 3415 | + | |
| 3416 | + | |
| 3417 | + | |
| 3418 | + | |
| 3419 | + | |
3403 | 3420 | | |
3404 | 3421 | | |
3405 | 3422 | | |
| |||
Lines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 11 | + | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
0 commit comments