* [PATCH] Fix PR65204
@ 2015-02-25 13:36 Richard Biener
2015-04-14 2:03 ` H.J. Lu
0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2015-02-25 13:36 UTC (permalink / raw)
To: gcc-patches
This fixes missed tracking of alignment of non-invariant addresses
in CCP.
Bootstrapped and tested on x86_64-unknown-linux-gnu, queued for GCC 6.
Richard.
2015-02-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/65204
* tree-ssa-ccp.c (evaluate_stmt): Always evaluate address
takens for bit-CCP.
* gcc.dg/tree-ssa/ssa-ccp-35.c: New testcase.
Index: gcc/tree-ssa-ccp.c
===================================================================
--- gcc/tree-ssa-ccp.c (revision 220958)
+++ gcc/tree-ssa-ccp.c (working copy)
@@ -1748,7 +1769,9 @@ evaluate_stmt (gimple stmt)
/* Resort to simplification for bitwise tracking. */
if (flag_tree_bit_ccp
- && (likelyvalue == CONSTANT || is_gimple_call (stmt))
+ && (likelyvalue == CONSTANT || is_gimple_call (stmt)
+ || (gimple_assign_single_p (stmt)
+ && gimple_assign_rhs_code (stmt) == ADDR_EXPR))
&& !is_constant)
{
enum gimple_code code = gimple_code (stmt);
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-35.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-35.c (revision 0)
+++ gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-35.c (working copy)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-ccp1" } */
+
+typedef char char16[16] __attribute__ ((aligned (16)));
+char16 c16[4] __attribute__ ((aligned (4)));
+
+int f5 (int i)
+{
+ __SIZE_TYPE__ s = (__SIZE_TYPE__)&c16[i];
+ /* 0 */
+ return 3 & s;
+}
+
+/* { dg-final { scan-tree-dump "return 0;" "ccp1" } } */
+/* { dg-final { cleanup-tree-dump "ccp1" } } */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix PR65204
2015-02-25 13:36 [PATCH] Fix PR65204 Richard Biener
@ 2015-04-14 2:03 ` H.J. Lu
2015-04-16 19:55 ` H.J. Lu
0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2015-04-14 2:03 UTC (permalink / raw)
To: Richard Biener; +Cc: GCC Patches
On Wed, Feb 25, 2015 at 5:26 AM, Richard Biener <rguenther@suse.de> wrote:
>
> This fixes missed tracking of alignment of non-invariant addresses
> in CCP.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, queued for GCC 6.
>
> Richard.
>
> 2015-02-25 Richard Biener <rguenther@suse.de>
>
> PR tree-optimization/65204
> * tree-ssa-ccp.c (evaluate_stmt): Always evaluate address
> takens for bit-CCP.
>
This caused:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65758
--
H.J.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix PR65204
2015-04-14 2:03 ` H.J. Lu
@ 2015-04-16 19:55 ` H.J. Lu
0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2015-04-16 19:55 UTC (permalink / raw)
To: Richard Biener; +Cc: GCC Patches
On Mon, Apr 13, 2015 at 7:03 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Feb 25, 2015 at 5:26 AM, Richard Biener <rguenther@suse.de> wrote:
>>
>> This fixes missed tracking of alignment of non-invariant addresses
>> in CCP.
>>
>> Bootstrapped and tested on x86_64-unknown-linux-gnu, queued for GCC 6.
>>
>> Richard.
>>
>> 2015-02-25 Richard Biener <rguenther@suse.de>
>>
>> PR tree-optimization/65204
>> * tree-ssa-ccp.c (evaluate_stmt): Always evaluate address
>> takens for bit-CCP.
>>
>
> This caused:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65758
This also caused:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65788
and r222085 didn't fix it.
--
H.J.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-16 19:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 13:36 [PATCH] Fix PR65204 Richard Biener
2015-04-14 2:03 ` H.J. Lu
2015-04-16 19:55 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).