Commit 5964a8e
committed
[LangRef] Require that vscale be a power of two
This change proposes that we require vscale to be a power of two.
This is already true for both in tree backends which support scalable
types.
We had two mechanism for exposing this to the optimizer.
First, we specify that any function with vscale_range must have
a vscale power-of-two type. In practice, clang will always emit this
attribute for RISCV and AArch64. Note there's a semantic oddity
here as vscale is required to be a global constant, and yet attributes
are per function.
Second, we have a TTI hook. Again, both targets which support scalable
vectors returned true for this hook.
This change removes both the TTI hook and the vscale_range
check in ValueTracking (since they're no longer needed), and
deletes the very small amount of code which becomes dead once
the results of the TTI hook are constant.
As can be seen from the test diffs, we had at least some places
which hadn't used the existing hooks. This might be an artifact
of the way the tests were written, I haven't checked closely.
The biggest argument against this change is that we might someday
want to support a non-power-of-two vscale. I argue that this
is false generality, and we should simplify for near term reality.
If a piece of hardware comes along with a register size which is
not a multiple of two (as the original SVE specification allowed
before it was revised), we can reverse this change at that time.1 parent c103bbc commit 5964a8e
File tree
26 files changed
+310
-462
lines changed- llvm
- docs
- include/llvm
- Analysis
- CodeGen
- lib
- Analysis
- CodeGen/SelectionDAG
- Target
- AArch64
- RISCV
- Transforms/Vectorize
- test/Transforms
- InstCombine
- InstSimplify
- LoopVectorize
- AArch64
- RISCV
26 files changed
+310
-462
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4442 | 4442 | | |
4443 | 4443 | | |
4444 | 4444 | | |
4445 | | - | |
4446 | | - | |
4447 | | - | |
4448 | | - | |
| 4445 | + | |
| 4446 | + | |
| 4447 | + | |
| 4448 | + | |
| 4449 | + | |
4449 | 4450 | | |
4450 | 4451 | | |
4451 | 4452 | | |
| |||
30398 | 30399 | | |
30399 | 30400 | | |
30400 | 30401 | | |
30401 | | - | |
30402 | | - | |
| 30402 | + | |
| 30403 | + | |
30403 | 30404 | | |
30404 | 30405 | | |
30405 | 30406 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1220 | 1220 | | |
1221 | 1221 | | |
1222 | 1222 | | |
1223 | | - | |
1224 | | - | |
1225 | | - | |
1226 | 1223 | | |
1227 | 1224 | | |
1228 | 1225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
594 | | - | |
595 | 594 | | |
596 | 595 | | |
597 | 596 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
864 | 864 | | |
865 | 865 | | |
866 | 866 | | |
867 | | - | |
868 | 867 | | |
869 | 868 | | |
870 | 869 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | 626 | | |
630 | 627 | | |
631 | 628 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | 798 | | |
803 | 799 | | |
804 | 800 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2474 | 2474 | | |
2475 | 2475 | | |
2476 | 2476 | | |
2477 | | - | |
2478 | | - | |
2479 | | - | |
2480 | | - | |
2481 | | - | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
2482 | 2480 | | |
2483 | 2481 | | |
2484 | 2482 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4660 | 4660 | | |
4661 | 4661 | | |
4662 | 4662 | | |
4663 | | - | |
4664 | 4663 | | |
4665 | 4664 | | |
4666 | 4665 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
520 | | - | |
521 | | - | |
522 | 520 | | |
523 | 521 | | |
524 | 522 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
160 | | - | |
161 | 159 | | |
162 | 160 | | |
163 | 161 | | |
| |||
0 commit comments