simplify: conservative handling of casts with pointers
On 05/08/2012 04:13 PM, Jan Pokorný wrote:
> When the cast is optimized out/target pointer type information lost,
> it may be impossible for backend to recover it (think of
> "struct foo *my_new_foo = malloc(sizeof(*my_new_foo))").
>
> Losing such pointer type information can be wider issue (structs and
> unions maybe), but this is the most exposed one and the patch tries
> to be minimal in this regard and the impact seems to be minimal
> too as usually type-correctness is followed.
I expected that if both operands of the cast appear to be pointers, it is
always OP_PTRCAST case, which is not true.
So this version exchanges inequality test for "or". Beside being
shorter, it covers such previously missed cases.
Based on asserts I experimented with, OP_PTRCASTs are always captured
by the condition implicitly (beside OP_CASTs with pointer-like operands).
Signed-off-by: Jan Pokorný <pokorny_jan@seznam.cz>
Signed-off-by: Christopher Li <sparse@chrisli.org>