From d36c27bedbc79f03d01fea5fdc8b5df4973c6c3d Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Sat, 30 Sep 2017 23:51:55 +0000 Subject: NewGVN: Fix PR 34473, by not using ExactlyEqualsExpression for finding phi of ops users. llvm-svn: 314612 --- llvm/lib/Transforms/Scalar/NewGVN.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Transforms/Scalar') diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index ae7df4c0356..8eb60194c29 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -2249,7 +2249,7 @@ void NewGVN::moveValueToNewCongruenceClass(Instruction *I, const Expression *E, // For a given expression, mark the phi of ops instructions that could have // changed as a result. void NewGVN::markPhiOfOpsChanged(const Expression *E) { - touchAndErase(ExpressionToPhiOfOps, ExactEqualsExpression(*E)); + touchAndErase(ExpressionToPhiOfOps, E); } // Perform congruence finding on a given value numbering expression. @@ -2668,6 +2668,7 @@ NewGVN::makePossiblePHIOfOps(Instruction *I, if (!DebugCounter::shouldExecute(PHIOfOpsCounter)) return nullptr; SmallVector Ops; + SmallPtrSet Deps; auto *PHIBlock = getBlockForValue(OpPHI); RevisitOnReachabilityChange[PHIBlock].reset(InstrToDFSNum(I)); for (unsigned PredNum = 0; PredNum < OpPHI->getNumOperands(); ++PredNum) { @@ -2686,18 +2687,15 @@ NewGVN::makePossiblePHIOfOps(Instruction *I, for (auto &Op : ValueOp->operands()) { auto *OrigOp = &*Op; // When these operand changes, it could change whether there is a - // leader for us or not, so we have to add additional users + // leader for us or not, so we have to add additional users. if (isa(Op)) { Op = Op->DoPHITranslation(PHIBlock, PredBB); if (Op != OrigOp && Op != I) - addAdditionalUsers(Op, I); + Deps.insert(Op); } else if (auto *ValuePHI = RealToTemp.lookup(Op)) { if (getBlockForValue(ValuePHI) == PHIBlock) Op = ValuePHI->getIncomingValue(PredNum); } - // When this operand changes, it could change whether there is a - // leader for us or not. - addAdditionalUsers(Op, I); // If we phi-translated the op, it must be safe. SafeForPHIOfOps = SafeForPHIOfOps && (Op != OrigOp || @@ -2726,6 +2724,8 @@ NewGVN::makePossiblePHIOfOps(Instruction *I, DEBUG(dbgs() << "Found phi of ops operand " << *FoundVal << " in " << getBlockName(PredBB) << "\n"); } + for (auto Dep : Deps) + addAdditionalUsers(Dep, I); sortPHIOps(Ops); auto *E = performSymbolicPHIEvaluation(Ops, I, PHIBlock); if (isa(E) || isa(E)) { -- cgit v1.2.3