aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-11-06 09:32:50 +0100
committerlemon <lsof@mailbox.org>2025-11-06 09:32:50 +0100
commitca73a7eef5ca52a0c95d500d9498a714bba12b02 (patch)
treed53b0c80d84e37a2faeb0d5b1d835447897f5fd6
parenta292164e0a590d5ddcab97b07c490983ba5eeaac (diff)
fold/builder: fix bad use of iscon in place of isnumcon
-rw-r--r--ir/builder.c8
-rw-r--r--ir/fold.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/ir/builder.c b/ir/builder.c
index 213a491..964099a 100644
--- a/ir/builder.c
+++ b/ir/builder.c
@@ -19,7 +19,7 @@ irbinop(struct function *fn, enum op op, enum irclass k, union ref l, union ref
if (r.bits == ZEROREF.bits) return l; /* x +/- 0 ==> x */
break;
case Omul: case Oumul:
- if (iscon(l)) rswap(l, r); /* put const in rhs */
+ if (isnumcon(l)) rswap(l, r); /* put const in rhs */
if (r.bits == ZEROREF.bits) /* x * 0 ==> 0 */
return ZEROREF;
if (r.bits == ONE.bits) /* x * 1 ==> x */
@@ -49,16 +49,16 @@ irbinop(struct function *fn, enum op op, enum irclass k, union ref l, union ref
}
break;
case Oand:
- if (iscon(l)) rswap(l, r); /* put const in rhs */
+ if (isnumcon(l)) rswap(l, r); /* put const in rhs */
if (r.bits == ZEROREF.bits) /* x & 0 ==> 0 */
return ZEROREF;
break;
case Oior:
- if (iscon(l)) rswap(l, r); /* put const in rhs */
+ if (isnumcon(l)) rswap(l, r); /* put const in rhs */
if (r.bits == ZEROREF.bits) /* x | 0 ==> x */
return l;
case Oxor:
- if (iscon(l)) rswap(l, r); /* put const in rhs */
+ if (isnumcon(l)) rswap(l, r); /* put const in rhs */
if (r.bits == ZEROREF.bits) /* x ^ 0 ==> x */
return l;
case Oshl: case Osar: case Oslr:
diff --git a/ir/fold.c b/ir/fold.c
index ce791fd..bfd78ff 100644
--- a/ir/fold.c
+++ b/ir/fold.c
@@ -89,7 +89,7 @@ foldflt(enum op op, enum irclass k, union ref lr, union ref rr)
bool
foldbinop(union ref *to, enum op op, enum irclass k, union ref l, union ref r)
{
- if (!iscon(l) || !iscon(r)) return 0;
+ if (!isnumcon(l) || !isnumcon(r)) return 0;
if (in_range(op, Odiv, Ourem) && (kisint(k) ? intconval(r) == 0 : fltconval(r) == 0))
return 0;
if (!oisarith(op))
@@ -104,7 +104,7 @@ foldbinop(union ref *to, enum op op, enum irclass k, union ref l, union ref r)
bool
foldunop(union ref *to, enum op op, enum irclass k, union ref a)
{
- if (!iscon(a)) return 0;
+ if (!isnumcon(a)) return 0;
if (op != Ocopy && !oisarith(op))
return 0;
if (kisint(k))