Commit 2678d35
committed
[DSE] Don't use initializes on byval argument
There are two ways we can fix this problem, depending on how the
semantics of byval and initializes should interact:
* Don't infer initializes on byval arguments. initializes on byval
refers to the original caller memory (or having both attributes
is made a verifier error).
* Infer initializes on byval, but don't use it in DSE. initializes
on byval refers to the callee copy. This matches the semantics of
readonly on byval. This is slightly more powerful, for example,
we could do a backend optimization where byval + initializes will
allocate the full size of byval on the stack but not copy over
the parts covered by initializes.
I went with the second variant here, skipping byval + initializes
in DSE (FunctionAttrs already doesn't propagate initializes past
byval). I'm open to going in the other direction though.
Fixes #126181.1 parent ae08969 commit 2678d35
File tree
3 files changed
+21
-1
lines changed- llvm
- docs
- lib/Transforms/Scalar
- test/Transforms/DeadStoreElimination
3 files changed
+21
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1707 | 1707 | | |
1708 | 1708 | | |
1709 | 1709 | | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
1710 | 1714 | | |
1711 | 1715 | | |
1712 | 1716 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2283 | 2283 | | |
2284 | 2284 | | |
2285 | 2285 | | |
2286 | | - | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
2287 | 2289 | | |
2288 | 2290 | | |
2289 | 2291 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
0 commit comments