aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
diff options
context:
space:
mode:
authorKAWASHIMA Takahiro <t-kawashima@fujitsu.com>2020-05-07 13:30:25 +0900
committerKAWASHIMA Takahiro <t-kawashima@fujitsu.com>2020-05-13 13:03:03 +0900
commit272bc25bc1401d5dc1407ad22a3172ee6914d007 (patch)
tree6288fcb9cab5f1a5aedc7eb7c21029ec49857a0f /llvm/lib/Bitcode/Reader/MetadataLoader.cpp
parent67087a7b76599ea783c1d930f0c2047deaa8fbae (diff)
downloadllvm-272bc25bc1401d5dc1407ad22a3172ee6914d007.zip
llvm-272bc25bc1401d5dc1407ad22a3172ee6914d007.tar.gz
llvm-272bc25bc1401d5dc1407ad22a3172ee6914d007.tar.bz2
[LoopReroll] Fix rerolling loop with use outside the loop
Fixes PR41696 The loop-reroll pass generates an invalid IR (or its assertion fails in debug build) if values of the base instruction and other root instructions (terms used in the loop-reroll pass) are used outside the loop block. See IRs written in PR41696 as examples. The current implementation of the loop-reroll pass can reroll only loops that don't have values that are used outside the loop, except reduced values (the last values of reduction chains). This is described in the comment of the `LoopReroll::reroll` function. https://github.com/llvm/llvm-project/blob/llvmorg-10.0.0/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp#L1600 This is checked in the `LoopReroll::DAGRootTracker::validate` function. https://github.com/llvm/llvm-project/blob/llvmorg-10.0.0/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp#L1393 However, the base instruction and other root instructions skip this check in the validation loop. https://github.com/llvm/llvm-project/blob/llvmorg-10.0.0/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp#L1229 Moving the check in front of the skip is the logically simplest fix. However, inserting the check in an earlier stage is better in terms of compilation time of unrerollable loops. This fix inserts the check for the base instruction into the function to validate possible base/root instructions. Check for other root instructions is unnecessary because they don't match any base instructions if they have uses outside the loop. Differential Revision: https://reviews.llvm.org/D79549
Diffstat (limited to 'llvm/lib/Bitcode/Reader/MetadataLoader.cpp')
0 files changed, 0 insertions, 0 deletions