Skip to content
8 changes: 7 additions & 1 deletion llvm/include/llvm/Transforms/Utils/SCCPSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,16 @@ class SCCPSolver {
LLVM_ABI void visit(Instruction *I);
LLVM_ABI void visitCall(CallInst &I);

/// Simplify instructions in \p BB using the solver's lattice information.
/// When \p Eager is true, also apply more aggressive folds that may rewrite
/// IR into forms less friendly to earlier canonicalization passes. Keep eager
/// mode for later optimization points where exposing extra range-based folds
/// outweighs the risk of hiding canonical patterns.
LLVM_ABI bool simplifyInstsInBlock(BasicBlock &BB,
SmallPtrSetImpl<Value *> &InsertedValues,
Statistic &InstRemovedStat,
Statistic &InstReplacedStat);
Statistic &InstReplacedStat,
bool Eager = false);

LLVM_ABI bool removeNonFeasibleEdges(BasicBlock *BB, DomTreeUpdater &DTU,
BasicBlock *&NewUnreachableBB) const;
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Transforms/Scalar/SCCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ static bool runSCCP(Function &F, const DataLayout &DL,
}

MadeChanges |= Solver.simplifyInstsInBlock(BB, InsertedValues,
NumInstRemoved, NumInstReplaced);
NumInstRemoved, NumInstReplaced,
/*Eager=*/true);
}

// Remove unreachable blocks and non-feasible edges.
Expand Down
Loading