Commit b13997b
committed
[AArch64][PAC] Do not fold ptrauth wrappers corresponding to
When parsing IR, we do some optimizations very early - for example, the
`constantFoldCompareGlobalToNull` function folds comparisons against
null pointer. If the value has `extern_weak` linkage or if it is an
llvm.ptrauth wrapper corresponding to a symbol with `extern_weak`
linkage, the folding is prevented.
When the llvm.ptrauth wrapper was defined after its usage in such
condition, its uses (including the use in the condition) were updated
when the wrapper definition was found, but before its section was
parsed. Since the "llvm.ptrauth" section name indicates that the value
is an llvm.ptrauth wrapper, not having it parsed before updating usages
made the folding code think that this is not an llvm.ptrauth wrapper,
which led to undesired folding.
This patch moves the code updating uses of the global value after the
code parsing its section name.extern_weak
1 parent 2a88245 commit b13997b
File tree
2 files changed
+14
-16
lines changed- llvm
- lib/AsmParser
- test/CodeGen/AArch64/GlobalISel
2 files changed
+14
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1256 | 1256 | | |
1257 | 1257 | | |
1258 | 1258 | | |
1259 | | - | |
1260 | | - | |
1261 | | - | |
1262 | | - | |
1263 | | - | |
1264 | | - | |
1265 | | - | |
1266 | | - | |
1267 | | - | |
1268 | | - | |
1269 | 1259 | | |
1270 | 1260 | | |
1271 | 1261 | | |
| |||
1303 | 1293 | | |
1304 | 1294 | | |
1305 | 1295 | | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
1306 | 1306 | | |
1307 | 1307 | | |
1308 | 1308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | 109 | | |
114 | 110 | | |
115 | 111 | | |
| |||
152 | 148 | | |
153 | 149 | | |
154 | 150 | | |
155 | | - | |
156 | | - | |
157 | 151 | | |
158 | 152 | | |
159 | 153 | | |
| |||
234 | 228 | | |
235 | 229 | | |
236 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
237 | 235 | | |
238 | 236 | | |
239 | 237 | | |
| |||
0 commit comments