Commit fa792cd
[AsmPrinter] Always emit global equivalents if there is non-global uses (llvm#145648)
A case found from rust-lang/rust#142752:
https://llvm.godbolt.org/z/T7ce9saWh.
We should emit `@bar_0` for the following code:
```llvm
target triple = "x86_64-unknown-linux-gnu"
@rel_0 = private unnamed_addr constant [1 x i32] [
i32 trunc (i64 sub (i64 ptrtoint (ptr @bar_0 to i64), i64 ptrtoint (ptr @rel_0 to i64)) to i32)]
@bar_0 = internal unnamed_addr constant ptr @foo_0, align 8
@foo_0 = external global ptr, align 8
define void @foo(ptr %arg0) {
store ptr @bar_0, ptr %arg0, align 8
ret void
}
```
(cherry picked from commit 630d55c)1 parent ce455b3 commit fa792cd
File tree
2 files changed
+53
-7
lines changed- llvm
- lib/CodeGen/AsmPrinter
- test/MC/X86
2 files changed
+53
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2139 | 2139 | | |
2140 | 2140 | | |
2141 | 2141 | | |
2142 | | - | |
2143 | | - | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
2144 | 2146 | | |
| 2147 | + | |
2145 | 2148 | | |
2146 | 2149 | | |
2147 | 2150 | | |
2148 | 2151 | | |
2149 | 2152 | | |
2150 | 2153 | | |
2151 | | - | |
| 2154 | + | |
| 2155 | + | |
2152 | 2156 | | |
2153 | 2157 | | |
2154 | 2158 | | |
| |||
2159 | 2163 | | |
2160 | 2164 | | |
2161 | 2165 | | |
2162 | | - | |
| 2166 | + | |
| 2167 | + | |
2163 | 2168 | | |
2164 | 2169 | | |
2165 | 2170 | | |
| |||
2171 | 2176 | | |
2172 | 2177 | | |
2173 | 2178 | | |
2174 | | - | |
| 2179 | + | |
| 2180 | + | |
2175 | 2181 | | |
2176 | 2182 | | |
2177 | 2183 | | |
| |||
2189 | 2195 | | |
2190 | 2196 | | |
2191 | 2197 | | |
2192 | | - | |
| 2198 | + | |
| 2199 | + | |
2193 | 2200 | | |
2194 | | - | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
2195 | 2205 | | |
2196 | 2206 | | |
2197 | 2207 | | |
| |||
| 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 | + | |
0 commit comments