Re: [PATCH] gimple-fold: Fix up decode_field_reference xor handling [PR118081]

2024-12-18 Thread Alexandre Oliva
On Dec 18, 2024, Jakub Jelinek wrote: > and the comment right above the xor_p handling says > /* Turn (a ^ b) [!]= 0 into a [!]= b. */ > but I don't see anything that would actually check that the other operand is > 0, in the testcase below it happily optimizes (a ^ 1) == 8 into a == 1. > The

Re: [PATCH] gimple-fold: Fix up decode_field_reference xor handling [PR118081]

2024-12-18 Thread Richard Biener
> Am 18.12.2024 um 10:10 schrieb Jakub Jelinek : > > Hi! > > The function comment says: > *XOR_P is to be FALSE if EXP might be a XOR used in a compare, in which > case, if XOR_CMP_OP is a zero constant, it will be overridden with *PEXP, > *XOR_P will be set to TRUE, and the left-hand o

[PATCH] gimple-fold: Fix up decode_field_reference xor handling [PR118081]

2024-12-18 Thread Jakub Jelinek
Hi! The function comment says: *XOR_P is to be FALSE if EXP might be a XOR used in a compare, in which case, if XOR_CMP_OP is a zero constant, it will be overridden with *PEXP, *XOR_P will be set to TRUE, and the left-hand operand of the XOR will be decoded. If *XOR_P is TRUE, XOR_CMP