11.5.0-2
Update gcc11-pr116034.patch Resolves: RHEL-50054
This commit is contained in:
parent
ffa87db2cc
commit
4670cc21fe
@ -1,29 +1,32 @@
|
|||||||
2024-07-22 Jakub Jelinek <jakub@redhat.com>
|
commit 084768c865cd50a6f7ff177db2dbdbb7aadaeee0
|
||||||
Andrew Pinski <quic_apinski@quicinc.com>
|
Author: Jakub Jelinek <jakub@redhat.com>
|
||||||
|
Date: Tue Jul 23 10:50:29 2024 +0200
|
||||||
|
|
||||||
PR tree-optimization/116034
|
ssa: Fix up maybe_rewrite_mem_ref_base complex type handling [PR116034]
|
||||||
* tree-sra.c (maybe_rewrite_mem_ref_base): Only use IMAGPART_EXPR
|
|
||||||
if MEM_REF offset is equal to element type size.
|
|
||||||
|
|
||||||
* gcc.dg/pr116034.c: New test.
|
The folding into REALPART_EXPR is correct, used only when the mem_offset
|
||||||
|
is zero, but for IMAGPART_EXPR it didn't check the exact offset value (just
|
||||||
|
that it is not 0).
|
||||||
|
The following patch fixes that by using IMAGPART_EXPR only if the offset
|
||||||
|
is right and using BITFIELD_REF or whatever else otherwise.
|
||||||
|
|
||||||
--- gcc/tree-ssa.c.jj 2024-03-11 11:00:46.768915988 +0100
|
2024-07-23 Jakub Jelinek <jakub@redhat.com>
|
||||||
+++ gcc/tree-ssa.c 2024-07-22 21:27:02.115530861 +0200
|
Andrew Pinski <quic_apinski@quicinc.com>
|
||||||
@@ -1506,7 +1506,10 @@ maybe_rewrite_mem_ref_base (tree *tp, bi
|
|
||||||
}
|
PR tree-optimization/116034
|
||||||
else if (TREE_CODE (TREE_TYPE (sym)) == COMPLEX_TYPE
|
* tree-ssa.cc (maybe_rewrite_mem_ref_base): Only use IMAGPART_EXPR
|
||||||
&& useless_type_conversion_p (TREE_TYPE (*tp),
|
if MEM_REF offset is equal to element type size.
|
||||||
- TREE_TYPE (TREE_TYPE (sym))))
|
|
||||||
+ TREE_TYPE (TREE_TYPE (sym)))
|
* gcc.dg/pr116034.c: New test.
|
||||||
+ && (integer_zerop (TREE_OPERAND (*tp, 1))
|
|
||||||
+ || tree_int_cst_equal (TREE_OPERAND (*tp, 1),
|
(cherry picked from commit b9cefd67a2a464a3c9413e6b3f28e7dc7a9ef162)
|
||||||
+ TYPE_SIZE_UNIT (TREE_TYPE (*tp)))))
|
|
||||||
{
|
diff --git a/gcc/testsuite/gcc.dg/pr116034.c b/gcc/testsuite/gcc.dg/pr116034.c
|
||||||
*tp = build1 (integer_zerop (TREE_OPERAND (*tp, 1))
|
new file mode 100644
|
||||||
? REALPART_EXPR : IMAGPART_EXPR,
|
index 00000000000..9a31de03424
|
||||||
--- gcc/testsuite/gcc.dg/pr116034.c.jj 2024-07-22 21:39:50.050994243 +0200
|
--- /dev/null
|
||||||
+++ gcc/testsuite/gcc.dg/pr116034.c 2024-07-22 21:39:32.432213042 +0200
|
+++ b/gcc/testsuite/gcc.dg/pr116034.c
|
||||||
@@ -0,0 +1,21 @@
|
@@ -0,0 +1,22 @@
|
||||||
+/* PR tree-optimization/116034 */
|
+/* PR tree-optimization/116034 */
|
||||||
+/* { dg-do run } */
|
+/* { dg-do run } */
|
||||||
+/* { dg-options "-O1 -fno-strict-aliasing" } */
|
+/* { dg-options "-O1 -fno-strict-aliasing" } */
|
||||||
@ -42,6 +45,23 @@
|
|||||||
+{
|
+{
|
||||||
+ if (__SIZEOF_SHORT__ == 2
|
+ if (__SIZEOF_SHORT__ == 2
|
||||||
+ && __CHAR_BIT__ == 8
|
+ && __CHAR_BIT__ == 8
|
||||||
+ && foo (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ? 0x0100 : 1) != 1)
|
+ && (foo (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__ ? 0x100 : 1)
|
||||||
|
+ != (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__ ? 1 : 0x100)))
|
||||||
+ __builtin_abort ();
|
+ __builtin_abort ();
|
||||||
+}
|
+}
|
||||||
|
diff --git a/gcc/tree-ssa.cc b/gcc/tree-ssa.cc
|
||||||
|
index 27ab9cfac82..f4fa4e98c5d 100644
|
||||||
|
--- a/gcc/tree-ssa.cc
|
||||||
|
+++ b/gcc/tree-ssa.cc
|
||||||
|
@@ -1506,7 +1506,10 @@ maybe_rewrite_mem_ref_base (tree *tp, bitmap suitable_for_renaming)
|
||||||
|
}
|
||||||
|
else if (TREE_CODE (TREE_TYPE (sym)) == COMPLEX_TYPE
|
||||||
|
&& useless_type_conversion_p (TREE_TYPE (*tp),
|
||||||
|
- TREE_TYPE (TREE_TYPE (sym))))
|
||||||
|
+ TREE_TYPE (TREE_TYPE (sym)))
|
||||||
|
+ && (integer_zerop (TREE_OPERAND (*tp, 1))
|
||||||
|
+ || tree_int_cst_equal (TREE_OPERAND (*tp, 1),
|
||||||
|
+ TYPE_SIZE_UNIT (TREE_TYPE (*tp)))))
|
||||||
|
{
|
||||||
|
*tp = build1 (integer_zerop (TREE_OPERAND (*tp, 1))
|
||||||
|
? REALPART_EXPR : IMAGPART_EXPR,
|
||||||
|
Loading…
Reference in New Issue
Block a user