DFG peephole: Only push SEL through COND when SEL is the only sink. (#6071)
This avoids potential O(n) logic duplication where 'n' is the fanout of the COND node. Fixes #6064.
This commit is contained in:
parent
5b2dc52681
commit
a6bae7f196
|
@ -844,7 +844,8 @@ class V3DfgPeephole final : public DfgVisitor {
|
|||
// Sel from Cond
|
||||
if (DfgCond* const condp = fromp->cast<DfgCond>()) {
|
||||
// If at least one of the branches are a constant, push the select past the cond
|
||||
if (condp->thenp()->is<DfgConst>() || condp->elsep()->is<DfgConst>()) {
|
||||
if (!condp->hasMultipleSinks()
|
||||
&& (condp->thenp()->is<DfgConst>() || condp->elsep()->is<DfgConst>())) {
|
||||
APPLYING(PUSH_SEL_THROUGH_COND) {
|
||||
// The new 'then' vertex
|
||||
DfgSel* const newThenp = make<DfgSel>(vtxp, condp->thenp(), lsb);
|
||||
|
|
Loading…
Reference in New Issue