Properly handle VIEW_CONVERT_EXPR in LHS (fixes 4.5 ACATS tests)
Richard Henderson
rth@redhat.com
Tue Nov 30 02:10:00 GMT 2004
On Sun, Nov 28, 2004 at 04:40:05PM -0500, Richard Kenner wrote:
> There are two issues here. First, if a VIEW_CONVERT_EXPR is on the LHS of
> MODIFY_EXPR, you can't automatically assume that this will be a V_MUST_DEF.
> Whether it's V_MUST_DEF or V_MAY_DEF still depends on whether there's a
> component (or array, ...) reference on the LHS. So we need to strip it off
> before doing the test.
These are two unrelated changes, and therefore should have been
submitted separately. This part is fine, but...
> Second, in CCP, when you store a value, if the LHS had a VIEW_CONVERT_EXPR,
> the value being stored is the wrong type and needs to be view-converted to
> the proper type.
This bit is buggy.
> ! if (TREE_CODE (orig_lhs) == VIEW_CONVERT_EXPR
> ! && val.lattice_val == CONSTANT)
> ! {
> ! val.const_val = build1 (VIEW_CONVERT_EXPR,
> ! TREE_TYPE (TREE_OPERAND (orig_lhs, 0)),
> ! val.const_val);
const_val must satisfy is_gimple_min_invariant, because it is
substituted into PHI nodes. In some cases, you may be able to
construct a correct replacement, but in others it'll be tricky.
I suggest
w = fold (build1 (VIEW_CONVERT_EXPR, ...))
if (is_gimple_min_invariant (w))
...
r~
More information about the Gcc-patches
mailing list