Restrict Dfg PUSH_SEL_THROUGH_CONCAT pattern (#6092)

This pattern is bit dubious and can blow up the size of the logic.
Restrict it to only apply if it strictly does not increase DFG size.
This commit is contained in:
Geza Lore 2025-06-15 23:10:42 +01:00 committed by GitHub
parent 173e9d2a94
commit 5e5b5ab69d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 6 deletions

View File

@ -774,12 +774,9 @@ class V3DfgPeephole final : public DfgVisitor {
DfgSel* const replacementp = make<DfgSel>(vtxp, lhsp, lsb - rhsp->width());
replace(vtxp, replacementp);
}
} else if (lsb == 0 || msb == concatp->width() - 1 //
|| lhsp->is<DfgConst>() || rhsp->is<DfgConst>() //
|| !concatp->hasMultipleSinks()) {
// If the select straddles both sides, but at least one of the sides is wholly
// selected, or at least one of the sides is a Const, or this concat has no other
// use, then push the Sel past the Concat
} else if (!concatp->hasMultipleSinks()) {
// If the select straddles both sides, the Concat has no other use,
// then push the Sel past the Concat
APPLYING(PUSH_SEL_THROUGH_CONCAT) {
const uint32_t rSelWidth = rhsp->width() - lsb;
const uint32_t lSelWidth = width - rSelWidth;