diff options
Diffstat (limited to 'gcc/tree-into-ssa.c')
-rw-r--r-- | gcc/tree-into-ssa.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index e5b59a7..0e78845 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -1378,12 +1378,20 @@ rewrite_add_phi_arguments (basic_block bb) for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi)) { - tree currdef, res; + tree currdef, res, argvar; location_t loc; phi = gsi.phi (); res = gimple_phi_result (phi); - currdef = get_reaching_def (SSA_NAME_VAR (res)); + /* If we have pre-existing PHI (via the GIMPLE FE) its args may + be different vars than existing vars and they may be constants + as well. Note the following supports partial SSA for PHI args. */ + argvar = gimple_phi_arg_def (phi, e->dest_idx); + if (argvar && ! DECL_P (argvar)) + continue; + if (!argvar) + argvar = SSA_NAME_VAR (res); + currdef = get_reaching_def (argvar); /* Virtual operand PHI args do not need a location. */ if (virtual_operand_p (res)) loc = UNKNOWN_LOCATION; |