Commit aa97726
[SCCP] Avoid modifying AdditionalUsers while iterating over it
When run under valgrind, or with a malloc that poisons freed memory,
this can lead to segfaults or other problems.
To avoid modifying the AdditionalUsers DenseMap while still iterating,
save the instructions to be notified in a separate SmallPtrSet, and use
this to later call OperandChangedState on each instruction.
Fixes PR49582.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D98602
(cherry picked from commit 6abb92f)1 parent b89942c commit aa97726
File tree
2 files changed
+860
-1
lines changed- llvm
- lib/Transforms/Scalar
- test/Transforms/SCCP
2 files changed
+860
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
542 | 542 | | |
543 | 543 | | |
544 | 544 | | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
545 | 548 | | |
546 | 549 | | |
547 | | - | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
548 | 553 | | |
549 | 554 | | |
550 | 555 | | |
| |||
0 commit comments