expr.c (expand_expr_real_1): For expanding TERed defs set the current location to...
authorRichard Biener <rguenther@suse.de>
Tue, 1 Sep 2015 13:27:17 +0000 (13:27 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 1 Sep 2015 13:27:17 +0000 (13:27 +0000)
2015-09-01  Richard Biener  <rguenther@suse.de>

* expr.c (expand_expr_real_1): For expanding TERed defs
set the current location to that of the def if not UNKNOWN.

From-SVN: r227370

gcc/ChangeLog
gcc/expr.c

index 725ae192d9a8c777ecf059d7f07602ffb46b8934..2bb787f728c322ae165cb4bd5614606e53589a87 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-01  Richard Biener  <rguenther@suse.de>
+
+       * expr.c (expand_expr_real_1): For expanding TERed defs
+       set the current location to that of the def if not UNKNOWN.
+
 2015-09-01  David Sherwood  <david.sherwood@arm.com>
 
        * genmodes.c: Add CONST_MODE_UNIT_SIZE modifier.
index 1e820b45a247bcccef29741057f5ebc20a63ecf5..ee0c1f932493b0fde22798d8be59842d11c440a7 100644 (file)
@@ -9463,6 +9463,10 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
       if (g)
        {
          rtx r;
+         location_t saved_loc = curr_insn_location ();
+         location_t loc = gimple_location (g);
+         if (loc != UNKNOWN_LOCATION)
+           set_curr_insn_location (loc);
          ops.code = gimple_assign_rhs_code (g);
           switch (get_gimple_rhs_class (ops.code))
            {
@@ -9484,21 +9488,19 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
            case GIMPLE_UNARY_RHS:
              ops.op0 = gimple_assign_rhs1 (g);
              ops.type = TREE_TYPE (gimple_assign_lhs (g));
-             ops.location = gimple_location (g);
+             ops.location = loc;
              r = expand_expr_real_2 (&ops, target, tmode, modifier);
              break;
            case GIMPLE_SINGLE_RHS:
              {
-               location_t saved_loc = curr_insn_location ();
-               set_curr_insn_location (gimple_location (g));
                r = expand_expr_real (gimple_assign_rhs1 (g), target,
                                      tmode, modifier, NULL, inner_reference_p);
-               set_curr_insn_location (saved_loc);
                break;
              }
            default:
              gcc_unreachable ();
            }
+         set_curr_insn_location (saved_loc);
          if (REG_P (r) && !REG_EXPR (r))
            set_reg_attrs_for_decl_rtl (SSA_NAME_VAR (exp), r);
          return r;