Commit e673cda
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 459939f commit e673cda
File tree
5 files changed
+22
-41
lines changed- llvm
- lib/Transforms/Vectorize
- test/Transforms/VectorCombine
- AMDGPU
- X86
5 files changed
+22
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4455 | 4455 | | |
4456 | 4456 | | |
4457 | 4457 | | |
4458 | | - | |
4459 | 4458 | | |
4460 | 4459 | | |
4461 | 4460 | | |
4462 | | - | |
4463 | | - | |
4464 | | - | |
4465 | | - | |
| 4461 | + | |
4466 | 4462 | | |
4467 | 4463 | | |
4468 | 4464 | | |
4469 | 4465 | | |
4470 | | - | |
4471 | | - | |
4472 | | - | |
4473 | | - | |
| 4466 | + | |
4474 | 4467 | | |
4475 | 4468 | | |
4476 | 4469 | | |
| |||
4491 | 4484 | | |
4492 | 4485 | | |
4493 | 4486 | | |
4494 | | - | |
4495 | | - | |
4496 | | - | |
| 4487 | + | |
| 4488 | + | |
| 4489 | + | |
4497 | 4490 | | |
4498 | | - | |
4499 | | - | |
4500 | | - | |
4501 | | - | |
| 4491 | + | |
4502 | 4492 | | |
4503 | 4493 | | |
4504 | 4494 | | |
| |||
Lines changed: 2 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
| 94 | + | |
| 95 | + | |
109 | 96 | | |
110 | 97 | | |
111 | 98 | | |
| |||
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