43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
From 3281cef37191a800d4fcc916c0e9d5c7a43802a4 Mon Sep 17 00:00:00 2001
|
|
From: XingYuShuai <1150775134@qq.com>
|
|
Date: Thu, 14 Dec 2023 20:11:35 +0800
|
|
Subject: [PATCH 1/2] [Loop CRC] Solving the problem of insufficient CRC table
|
|
validation
|
|
|
|
---
|
|
gcc/tree-ssa-loop-crc.c | 8 +++++---
|
|
1 file changed, 5 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/gcc/tree-ssa-loop-crc.c b/gcc/tree-ssa-loop-crc.c
|
|
index 9878363eb..2dd9e1e3b 100644
|
|
--- a/gcc/tree-ssa-loop-crc.c
|
|
+++ b/gcc/tree-ssa-loop-crc.c
|
|
@@ -336,11 +336,14 @@ only_one_array_read (class loop *loop, tree &crc_table)
|
|
&& TREE_CODE (gimple_assign_lhs (stmt)) == ARRAY_REF)
|
|
return false;
|
|
|
|
+ /* Only one-dimensional integer arrays meet the condition. */
|
|
if (gimple_code (stmt) == GIMPLE_ASSIGN
|
|
- && TREE_CODE (gimple_assign_rhs1 (stmt)) == ARRAY_REF)
|
|
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == ARRAY_REF
|
|
+ && TREE_CODE (TREE_OPERAND (gimple_assign_rhs1 (stmt), 0)) == VAR_DECL
|
|
+ && TREE_CODE (TREE_TYPE (gimple_assign_rhs1 (stmt))) == INTEGER_TYPE)
|
|
{
|
|
if (crc_table == NULL
|
|
- && gimple_assign_rhs1 (stmt)->base.readonly_flag)
|
|
+ && TREE_READONLY (gimple_assign_rhs1 (stmt)))
|
|
{
|
|
crc_table = gimple_assign_rhs1 (stmt);
|
|
crc_table_read_stmt = stmt;
|
|
@@ -438,7 +441,6 @@ match_crc_table (tree crc_table)
|
|
return true;
|
|
}
|
|
|
|
-
|
|
/* Check the crc table. The loop should have only one data reference.
|
|
And match the data reference with the predefined array. */
|
|
static bool
|
|
--
|
|
2.33.0
|
|
|