Commit 2ee921f
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 316715e commit 2ee921f
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 | |
|---|---|---|---|
| |||
4558 | 4558 | | |
4559 | 4559 | | |
4560 | 4560 | | |
4561 | | - | |
4562 | 4561 | | |
4563 | 4562 | | |
4564 | 4563 | | |
4565 | | - | |
4566 | | - | |
4567 | | - | |
4568 | | - | |
| 4564 | + | |
4569 | 4565 | | |
4570 | 4566 | | |
4571 | 4567 | | |
4572 | 4568 | | |
4573 | | - | |
4574 | | - | |
4575 | | - | |
4576 | | - | |
| 4569 | + | |
4577 | 4570 | | |
4578 | 4571 | | |
4579 | 4572 | | |
| |||
4594 | 4587 | | |
4595 | 4588 | | |
4596 | 4589 | | |
4597 | | - | |
4598 | | - | |
4599 | | - | |
| 4590 | + | |
| 4591 | + | |
| 4592 | + | |
4600 | 4593 | | |
4601 | | - | |
4602 | | - | |
4603 | | - | |
4604 | | - | |
| 4594 | + | |
4605 | 4595 | | |
4606 | 4596 | | |
4607 | 4597 | | |
| |||
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