aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2024-06-14 10:38:50 +0200
committerGitHub <noreply@github.com>2024-06-14 10:38:50 +0200
commitdfde0773fdee9301e5f2181e1dbcbb0dc3602e08 (patch)
treed159092a9fd5a36abc820b9f7aed50877894ab07 /llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
parentda249cad8d398939e0c608d38d0c038954941316 (diff)
downloadllvm-dfde0773fdee9301e5f2181e1dbcbb0dc3602e08.zip
llvm-dfde0773fdee9301e5f2181e1dbcbb0dc3602e08.tar.gz
llvm-dfde0773fdee9301e5f2181e1dbcbb0dc3602e08.tar.bz2
[SimplifyCFG] More accurate use legality check for sinking (#94462)
When sinking instructions, we have to make sure that the uses of that instruction are consistent: If used in a phi node in the sink target, then the phi operands have to match the sink candidates. This allows the phi to be removed when the instruction is sunk. This case is already handled accurately. However, what the current code doesn't handle are uses in the same block. These are just unconditionally accepted, even though this needs the same consistency check for the phi node that sinking the using instruction would introduce. Instead, the code has another check when actually performing the sinking, which repeats the phi check (just at a later time, where all the later instructions have already been sunk and any new phis introduced). This is problematic, because it messes up the profitability heuristic. The code will think that certain instructions will get sunk, but they actually won't. This may result in more phi nodes being created than is considered profitable. See the changed test for a case where we no longer do this after this patch. The new approach makes sure that the uses are consistent during the initial legality check. This is based on PhiOperands, which we already collect. The primary motivation for this is to generalize sinking to support more than one use, and doing that generalization is hard with the current split checking approach.
Diffstat (limited to 'llvm/lib/ProfileData/Coverage/CoverageMapping.cpp')
0 files changed, 0 insertions, 0 deletions