diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index ad00552f04a..0d1d57d6486 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -1905,7 +1905,14 @@ void ReassociatePass::EraseInst(Instruction *I) { while (Op->hasOneUse() && Op->user_back()->getOpcode() == Opcode && Visited.insert(Op).second) Op = Op->user_back(); - RedoInsts.insert(Op); + + // The instruction we're going to push may be coming from a + // dead block, and Reassociate skips the processing of unreachable + // blocks because it's a waste of time and also because it can + // lead to infinite loop due to LLVM's non-standard definition + // of dominance. + if (ValueRankMap.find(Op) != ValueRankMap.end()) + RedoInsts.insert(Op); } MadeChange = true; |