Commit a774e7f
authored
[SPIR-V] Fix OpName and LinkageAttributes decoration of global variables (llvm#120492)
This PR changes `getGlobalIdentifier()` into `getName()` value when
creating a name of a global variable, and fixes generation of
LinkageAttributes decoration of global variables by taking into account
Private Linkage in addition to Internal.
Previous implementation led to an issue with back translation of SPIR-V
to LLVM IR, e.g.:
```
@__const.G1 = private unnamed_addr addrspace(1) constant %my_type undef
...
Fails to verify module: 'common' global may not be marked constant!
ptr addrspace(1) @"llvm-link;__const.G1"
```
A reproducer is included as a new test case.1 parent 66acb26 commit a774e7f
File tree
4 files changed
+74
-12
lines changed- llvm
- lib/Target/SPIRV
- test/CodeGen/SPIRV
4 files changed
+74
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1841 | 1841 | | |
1842 | 1842 | | |
1843 | 1843 | | |
1844 | | - | |
| 1844 | + | |
| 1845 | + | |
1845 | 1846 | | |
1846 | 1847 | | |
1847 | 1848 | | |
1848 | 1849 | | |
1849 | | - | |
| 1850 | + | |
1850 | 1851 | | |
1851 | 1852 | | |
1852 | 1853 | | |
1853 | 1854 | | |
1854 | 1855 | | |
1855 | 1856 | | |
1856 | | - | |
1857 | | - | |
| 1857 | + | |
1858 | 1858 | | |
1859 | 1859 | | |
1860 | 1860 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3478 | 3478 | | |
3479 | 3479 | | |
3480 | 3480 | | |
3481 | | - | |
| 3481 | + | |
3482 | 3482 | | |
3483 | 3483 | | |
3484 | 3484 | | |
| |||
3541 | 3541 | | |
3542 | 3542 | | |
3543 | 3543 | | |
3544 | | - | |
3545 | | - | |
3546 | | - | |
| 3544 | + | |
3547 | 3545 | | |
3548 | | - | |
| 3546 | + | |
3549 | 3547 | | |
3550 | 3548 | | |
3551 | | - | |
| 3549 | + | |
3552 | 3550 | | |
3553 | | - | |
| 3551 | + | |
3554 | 3552 | | |
3555 | | - | |
| 3553 | + | |
3556 | 3554 | | |
3557 | 3555 | | |
3558 | 3556 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
236 | 237 | | |
237 | 238 | | |
238 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
239 | 244 | | |
240 | 245 | | |
241 | 246 | | |
| |||
| 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 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
0 commit comments