On Tue, 30 Jun 2015, Marek Polacek wrote:

I put some more converts into the pattern, but then it's turned
out that I also need the tree_nop_conversion_p (otherwise we'd
regress binop-notor2.c that uses booleans).

I don't really see why removing tree_nop_conversion_p would regress anything
(though you would probably need to build the all_ones constant in TREE_TYPE
(@0) and convert that to type). For my curiosity, could you explain a bit
more?

This wasn't all that clear to me.  The testcase in question is

int
foo (_Bool a, _Bool b)
{
 return (a | (a == 0)) | ((b ^ 1) | b);
}

this ought to be simplified to "return 1".  Through various folding we
arrive at

(int) ~b | (int) b

so we'd turn that into -1 (all_ones_cst of type int).  But for boolean b
"~b | b" is always 1, right?

Does my suggestion to "build the all_ones constant in TREE_TYPE (@0) and convert that to type" help for that?

--
Marc Glisse

Reply via email to