diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2021-03-23 17:33:40 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2021-03-23 17:37:28 +0300 |
commit | 514bc01ca3b9f97945dd49aa40e01922fed0e41d (patch) | |
tree | 5f0a8fabd63f14b82a6d354951bd30bcd06efa12 /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | bc6b139392f638a69e85a474eb0eb59e13d9791a (diff) | |
download | llvm-514bc01ca3b9f97945dd49aa40e01922fed0e41d.zip llvm-514bc01ca3b9f97945dd49aa40e01922fed0e41d.tar.gz llvm-514bc01ca3b9f97945dd49aa40e01922fed0e41d.tar.bz2 |
[SimplifyCFG] FoldBranchToCommonDest(): properly handle same-block external uses (PR49510/PR49689)
We clone bonus instructions to the end of the predecessor block,
and then use `SSAUpdater::RewriteUseAfterInsertions()`.
But that only deals with the cases where the use-to-be-rewritten
are either in different block from the def, or come after the def.
But in some loop cases, the external use may be in the beginning of
predecessor block, before the newly cloned bonus instruction.
`SSAUpdater::RewriteUseAfterInsertions()` does not deal with that.
Notably, the external use can't happen to be both in the same block
and *after* the newly-cloned instruction, because of the fold preconditions.
To properly handle these cases, when the use is in the same block,
we should instead use `SSAUpdater::RewriteUse()`.
TBN, they do the same thing for PHI users.
Fixes https://bugs.llvm.org/show_bug.cgi?id=49510
Likely Fixes https://bugs.llvm.org/show_bug.cgi?id=49689
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions