Commit 75ec529
committed
[Mem2Reg] Don't use single store optimization for potentially poison value (llvm#97711)
If there is a single store, then loads must either load the stored value
or uninitialized memory (undef). If the stored value may be poison, then
replacing an uninitialized memory load with it would be incorrect. Fall
back to the generic code in that case.
This PR only fixes the case where there is a literal poison store -- the
case where the value is non-trivially poison will still get miscompiled
by phi simplification later, see llvm#96631.
Fixes llvm#97702.
(cherry picked from commit f58930f)1 parent 855a732 commit 75ec529
File tree
2 files changed
+9
-4
lines changed- llvm
- lib/Transforms/Utils
- test/Transforms/Mem2Reg
2 files changed
+9
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
514 | | - | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
515 | 522 | | |
516 | 523 | | |
517 | 524 | | |
| |||
551 | 558 | | |
552 | 559 | | |
553 | 560 | | |
554 | | - | |
555 | 561 | | |
556 | 562 | | |
557 | 563 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
| 11 | + | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
0 commit comments