diff --git a/src/operators.c b/src/operators.c index be7f3f44abc80879ba5d09d29721b023f1868e1c..2cb243bb8147f078d04c1d779187f2d444540c99 100644 --- a/src/operators.c +++ b/src/operators.c @@ -1854,6 +1854,11 @@ static node *optimize_eq(node *n) if(!first_arg || !second_arg) Pike_fatal("Couldn't find argument!\n"); #endif + +#if 0 + /* Disabled these - boolean falsehood is not the same thing as + * equality with the integer 0. */ + if(node_is_false(*first_arg) && !node_may_overload(*second_arg,LFUN_EQ)) { ret=*second_arg; @@ -1867,6 +1872,7 @@ static node *optimize_eq(node *n) ADD_NODE_REF(*first_arg); return mkopernode("`!",ret,0); } +#endif if (((*second_arg)->token == F_CONSTANT) && ((*second_arg)->u.sval.type == T_STRING) && diff --git a/src/peep.in b/src/peep.in index 7cf9528de15eb1ea726c3b43237bda4fa49a98d4..763180bde257ed65297d917e7aef6ae4dd245fff 100644 --- a/src/peep.in +++ b/src/peep.in @@ -169,6 +169,8 @@ NUMBER [$1a] BRANCH_WHEN_NON_ZERO: BRANCH($2a) // These optimizations are now handled in optimize_eq // CONST0 BRANCH_WHEN_EQ: BRANCH_WHEN_ZERO($2a) // CONST0 BRANCH_WHEN_NE: BRANCH_WHEN_NON_ZERO($2a) +// +// This one is not safe. // CONST0 EQ: NOT EQ BRANCH_WHEN_NON_ZERO: BRANCH_WHEN_EQ ($2a)