Internals: Optimize empty 'if' into StmtExpr

This commit is contained in:
Wilson Snyder
2025-08-08 05:10:40 -04:00
parent 6a225d5d00
commit d1f851e1e1
5 changed files with 18 additions and 6 deletions
+2 -1
View File
@@ -1510,7 +1510,8 @@ class TaskVisitor final : public VNVisitor {
VIsCached::clearCacheTree();
} else { // VN_IS(nodep->backp(), StmtExpr)
insertBeforeStmt(nodep, beginp);
if (nodep->taskp()->isFunction()) {
if (nodep->taskp()->isFunction()
&& !nodep->backp()->fileline()->warnIsOff(V3ErrorCode::IGNOREDRETURN)) {
nodep->v3warn(
IGNOREDRETURN,
"Ignoring return value of non-void function (IEEE 1800-2023 13.4.1)");