diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/NewGVN.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index d4e41e1c0ad..fe5a43872f5 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -430,12 +430,10 @@ PHIExpression *NewGVN::createPHIExpression(Instruction *I) { E->setType(I->getType()); E->setOpcode(I->getOpcode()); - auto ReachablePhiArg = [&](const Use &U) { + // Filter out unreachable phi operands. + auto Filtered = make_filter_range(PN->operands(), [&](const Use &U) { return ReachableBlocks.count(PN->getIncomingBlock(U)); - }; - - // Filter out unreachable operands - auto Filtered = make_filter_range(PN->operands(), ReachablePhiArg); + }); std::transform(Filtered.begin(), Filtered.end(), op_inserter(E), [&](const Use &U) -> Value * { |

