Commit a3ae0dd
authored
[InferAddressSpaces] Add InferAddressSpaces pass to pipeline for SPIR (#7418)
Clang generates 'addrspacecast' instructions to align address spaces
between alloca/global variables/kernel parameters and flat address space
pointers (i.e. addrspace(4)).
For the SPIR/SPIR-V target, addrspace(4) is the generic address space
and these addrspacecast instructions can be safely removed from the code
when named address space can be deduced.
To perform this removing, the InferAddressSpaces pass has been added to
the clang optimization pipeline for SPIR and SPIR-V targets. This pass
should be run after the other optimization passes (both function and
module) and, it is very important, after inlining to let the pass
"understand" from which address space as many as possible variables came
and eliminate as many as possible addrspacecast instructions.
The elimination of redundant addrspacecast instruction decreases the
size of the generated SPIR-V module and therefore makes less pressure on
the backend/JIT compilers.1 parent cd832bf commit a3ae0dd
File tree
3 files changed
+52
-1
lines changed- clang
- include/clang/Basic/Targets
- lib/CodeGen
- test/CodeGenSYCL
3 files changed
+52
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| 91 | + | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| |||
897 | 899 | | |
898 | 900 | | |
899 | 901 | | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
900 | 911 | | |
901 | 912 | | |
902 | 913 | | |
| |||
999 | 1010 | | |
1000 | 1011 | | |
1001 | 1012 | | |
1002 | | - | |
| 1013 | + | |
1003 | 1014 | | |
1004 | 1015 | | |
1005 | 1016 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments