Commit 80ca305
committed
VectorCombine: Improve the insert/extract fold in the narrowing case
Keeping the extracted element in a natural position in the narrowed
vector has two beneficial effects:
1. It makes the narrowing shuffles cheaper (at least on AMDGPU), which
allows the insert/extract fold to trigger.
2. It makes the narrowing shuffles in a chain of extract/insert
compatible, which allows foldLengthChangingShuffles to successfully
recognize a chain that can be folded.
There are minor X86 test changes that look reasonable to me. The IR
change for AVX2 in llvm/test/Transforms/VectorCombine/X86/extract-insert-poison.ll
doesn't change the assembly generated by `llc -mtriple=x86_64-- -mattr=AVX2`
at all.
commit-id:c151bb041 parent 1c241c1 commit 80ca305
File tree
5 files changed
+22
-42
lines changed- llvm
- lib/Transforms/Vectorize
- test/Transforms/VectorCombine
- AMDGPU
- X86
5 files changed
+22
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4479 | 4479 | | |
4480 | 4480 | | |
4481 | 4481 | | |
4482 | | - | |
4483 | 4482 | | |
4484 | 4483 | | |
4485 | 4484 | | |
4486 | | - | |
4487 | | - | |
4488 | | - | |
4489 | | - | |
| 4485 | + | |
4490 | 4486 | | |
4491 | 4487 | | |
4492 | 4488 | | |
4493 | 4489 | | |
4494 | | - | |
4495 | | - | |
4496 | | - | |
4497 | | - | |
| 4490 | + | |
4498 | 4491 | | |
4499 | 4492 | | |
4500 | 4493 | | |
| |||
4515 | 4508 | | |
4516 | 4509 | | |
4517 | 4510 | | |
4518 | | - | |
4519 | | - | |
4520 | | - | |
| 4511 | + | |
| 4512 | + | |
| 4513 | + | |
4521 | 4514 | | |
4522 | | - | |
4523 | | - | |
4524 | | - | |
4525 | | - | |
| 4515 | + | |
4526 | 4516 | | |
4527 | 4517 | | |
4528 | 4518 | | |
| |||
Lines changed: 2 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
| 91 | + | |
| 92 | + | |
107 | 93 | | |
108 | 94 | | |
109 | 95 | | |
| |||
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
147 | 151 | | |
148 | 152 | | |
149 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
| 139 | + | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
189 | | - | |
| 188 | + | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
0 commit comments