aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-12-22 09:51:02 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-12-22 09:51:02 +0000
commitf4fd20a2f05bc06a6eae5d5cbf8e03c33c8b80a2 (patch)
treee31cc101816fc0810e2d00b51db56206319e5674 /gcc
parent102a9b43207e6fb7d427e23382a1f9b148829b34 (diff)
downloadgcc-f4fd20a2f05bc06a6eae5d5cbf8e03c33c8b80a2.zip
gcc-f4fd20a2f05bc06a6eae5d5cbf8e03c33c8b80a2.tar.gz
gcc-f4fd20a2f05bc06a6eae5d5cbf8e03c33c8b80a2.tar.bz2
re PR debug/60756 (var-tracking selects wrong registers)
PR debug/60756 * var-tracking.c (tracked_record_parameter_p): New predicate. (track_expr_p): Invoke it. (add_stores): Likewise. From-SVN: r231897
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/var-tracking.c40
2 files changed, 33 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9e3ab5a..da6b923 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-12-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR debug/60756
+ * var-tracking.c (tracked_record_parameter_p): New predicate.
+ (track_expr_p): Invoke it.
+ (add_stores): Likewise.
+
2015-12-21 Jeff Law <law@redhat.com>
* dbgcnt.def (dom_unreachable_edges): New debug counter.
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 07eea84..a5cca2b 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -5020,6 +5020,27 @@ dataflow_set_destroy (dataflow_set *set)
set->vars = NULL;
}
+/* Return true if T is a tracked parameter with non-degenerate record type. */
+
+static bool
+tracked_record_parameter_p (tree t)
+{
+ if (TREE_CODE (t) != PARM_DECL)
+ return false;
+
+ if (DECL_MODE (t) == BLKmode)
+ return false;
+
+ tree type = TREE_TYPE (t);
+ if (TREE_CODE (type) != RECORD_TYPE)
+ return false;
+
+ if (DECL_CHAIN (TYPE_FIELDS (type)) == NULL_TREE)
+ return false;
+
+ return true;
+}
+
/* Shall EXPR be tracked? */
static bool
@@ -5064,11 +5085,9 @@ track_expr_p (tree expr, bool need_rtl)
&maxsize, &reverse);
if (!DECL_P (innerdecl)
|| DECL_IGNORED_P (innerdecl)
- /* Do not track declarations for parts of tracked parameters
- since we want to track them as a whole instead. */
- || (TREE_CODE (innerdecl) == PARM_DECL
- && DECL_MODE (innerdecl) != BLKmode
- && TREE_CODE (TREE_TYPE (innerdecl)) != UNION_TYPE)
+ /* Do not track declarations for parts of tracked record
+ parameters since we want to track them as a whole. */
+ || tracked_record_parameter_p (innerdecl)
|| TREE_STATIC (innerdecl)
|| bitsize <= 0
|| bitpos + bitsize > 256
@@ -5928,18 +5947,11 @@ add_stores (rtx loc, const_rtx expr, void *cuip)
resolve = preserve = !cselib_preserved_value_p (v);
/* We cannot track values for multiple-part variables, so we track only
- locations for tracked parameters passed either by invisible reference
- or directly in multiple locations. */
+ locations for tracked record parameters. */
if (track_p
&& REG_P (loc)
&& REG_EXPR (loc)
- && TREE_CODE (REG_EXPR (loc)) == PARM_DECL
- && DECL_MODE (REG_EXPR (loc)) != BLKmode
- && TREE_CODE (TREE_TYPE (REG_EXPR (loc))) != UNION_TYPE
- && ((MEM_P (DECL_INCOMING_RTL (REG_EXPR (loc)))
- && XEXP (DECL_INCOMING_RTL (REG_EXPR (loc)), 0) != arg_pointer_rtx)
- || (GET_CODE (DECL_INCOMING_RTL (REG_EXPR (loc))) == PARALLEL
- && XVECLEN (DECL_INCOMING_RTL (REG_EXPR (loc)), 0) > 1)))
+ && tracked_record_parameter_p (REG_EXPR (loc)))
{
/* Although we don't use the value here, it could be used later by the
mere virtue of its existence as the operand of the reverse operation