[all-commits] [llvm/llvm-project] 6abb92: [SCCP] Avoid modifying AdditionalUsers while itera...
Dimitry Andric via All-commits
all-commits at lists.llvm.org
Fri Apr 2 10:06:30 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6abb92f2103a58d097620b4410054c5bb18c48ec
https://github.com/llvm/llvm-project/commit/6abb92f2103a58d097620b4410054c5bb18c48ec
Author: Dimitry Andric <dimitry at andric.com>
Date: 2021-04-02 (Fri, 02 Apr 2021)
Changed paths:
M llvm/lib/Transforms/Scalar/SCCP.cpp
A llvm/test/Transforms/SCCP/pr49582-iterator-invalidation.ll
Log Message:
-----------
[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
More information about the All-commits
mailing list