Use narrowest RedXor

This commit is contained in:
Geza Lore
2021-08-18 22:00:09 +01:00
parent 8f527a0c6e
commit fffc63970d
2 changed files with 10 additions and 4 deletions
+4 -3
View File
@@ -155,9 +155,10 @@ private:
}
}
virtual void visit(AstVarRef* nodep) override {
if (nodep->access().isReadOnly() && !VN_IS(nodep->backp(), CCast)
&& VN_IS(nodep->backp(), NodeMath) && !VN_IS(nodep->backp(), ArraySel)
&& nodep->backp()->width() && castSize(nodep) != castSize(nodep->varp())) {
AstNode* const backp = nodep->backp();
if (nodep->access().isReadOnly() && !VN_IS(backp, CCast) && VN_IS(backp, NodeMath)
&& !VN_IS(backp, ArraySel) && !VN_IS(backp, RedXor) && backp->width()
&& castSize(nodep) != castSize(nodep->varp())) {
// Cast vars to IData first, else below has upper bits wrongly set
// CData x=3; out = (QData)(x<<30);
insertCast(nodep, castSize(nodep));