summaryrefslogtreecommitdiff
path: root/chapter25/src/main
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-09-11 17:12:32 -0700
committerCliff Click <cliffc@acm.org>2026-09-11 17:12:32 -0700
commitcab27a1f349f60eb8ee5bd97ac7fde5cd4547265 (patch)
treee470aa1e96e027c3ecafd2b30090a877668045d0 /chapter25/src/main
parent5b07c027577503f4d9ecb7ea6c950cb24a144347 (diff)
downloadSimple-cab27a1f349f60eb8ee5bd97ac7fde5cd4547265.tar.gz
Simple-cab27a1f349f60eb8ee5bd97ac7fde5cd4547265.zip
Fix OR of 0
Allowed only if the replacement does not fall, will be lifted by OR to an TypeInteger
Diffstat (limited to 'chapter25/src/main')
-rw-r--r--chapter25/src/main/java/com/seaofnodes/simple/node/OrNode.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/chapter25/src/main/java/com/seaofnodes/simple/node/OrNode.java b/chapter25/src/main/java/com/seaofnodes/simple/node/OrNode.java
index ba250c26..66e561dc 100644
--- a/chapter25/src/main/java/com/seaofnodes/simple/node/OrNode.java
+++ b/chapter25/src/main/java/com/seaofnodes/simple/node/OrNode.java
@@ -27,7 +27,7 @@ public class OrNode extends ArithNode {
// Or of 0. We do not check for (0|x) because this will already
// canonicalize to (x|0)
- if( t2.isConstant() && t2 instanceof TypeInteger i && i.value()==0 )
+ if( t2.isConstant() && t2 instanceof TypeInteger i && i.value()==0 && t1.isa(TypeInteger.BOT) )
return lhs;
// Move constants to RHS: con*arg becomes arg*con