Commit 88bd565
authored
VectorCombine: Improve the insert/extract fold in the narrowing case (#168820)
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.1 parent bb1bfb1 commit 88bd565
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 | |
|---|---|---|---|
| |||
4575 | 4575 | | |
4576 | 4576 | | |
4577 | 4577 | | |
4578 | | - | |
4579 | 4578 | | |
4580 | 4579 | | |
4581 | 4580 | | |
4582 | | - | |
4583 | | - | |
4584 | | - | |
4585 | | - | |
| 4581 | + | |
4586 | 4582 | | |
4587 | 4583 | | |
4588 | 4584 | | |
4589 | 4585 | | |
4590 | | - | |
4591 | | - | |
4592 | | - | |
4593 | | - | |
| 4586 | + | |
4594 | 4587 | | |
4595 | 4588 | | |
4596 | 4589 | | |
| |||
4611 | 4604 | | |
4612 | 4605 | | |
4613 | 4606 | | |
4614 | | - | |
4615 | | - | |
4616 | | - | |
| 4607 | + | |
| 4608 | + | |
| 4609 | + | |
4617 | 4610 | | |
4618 | | - | |
4619 | | - | |
4620 | | - | |
4621 | | - | |
| 4611 | + | |
4622 | 4612 | | |
4623 | 4613 | | |
4624 | 4614 | | |
| |||
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