This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Properly handle VIEW_CONVERT_EXPR in LHS (fixes 4.5 ACATS tests)
- From: Richard Henderson <rth at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: dnovillo at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Mon, 29 Nov 2004 17:57:47 -0800
- Subject: Re: Properly handle VIEW_CONVERT_EXPR in LHS (fixes 4.5 ACATS tests)
- References: <10411282140.AA23632@vlsi1.ultra.nyu.edu>
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~