Optimize temporary insertion for single bit replicates in DFG (#8110)

A '{N{bit}}' mask expands to a bit vector where every word is the same
value, obtained by negating the replicated bit. Recomputing that at each
use is no more expensive than loading it
This commit is contained in:
Geza Lore 2026-08-14 14:58:31 +02:00 committed by GitHub
parent 2957939d4b
commit 0a3657517d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -829,6 +829,13 @@ bool DfgVertex::isCheaperThanLoad() const {
const uint32_t msb = lsb + selp->width() - 1;
return VL_BITWORD_E(msb) == VL_BITWORD_E(lsb);
}
// Replication of a single cheap bit. Each word of the result is the same
// mask computed by negating that bit, so recomputing it at each use costs
// no more than the load it replaces.
if (const DfgRep* const repp = cast<DfgRep>()) {
const DfgVertex* const srcp = repp->srcp();
return srcp->width() == 1 && srcp->isCheaperThanLoad();
}
// Zero extend of a cheap vertex - Extend(_) was converted to Concat(0, _)
if (const DfgConcat* const catp = cast<DfgConcat>()) {
if (catp->width() > VL_QUADSIZE) return false;