[PATCH PR94266] aarch64:ICE during GIMPLE pass: forwprop

2020-03-22 Thread qianchao
Hi

The attached testcase triggers ICE when testing GCC trunk on aarch64 with -S 
-O2 -ftree-loop-vectorize -march=armv8.2-a+sve -msve-vector-bits=256.

Before the forwprop pass, we have two gimple statements as follows:

_43 = &MEM[base: _5, offset: 0B];
vect__2.7_24 = MEM  [(int *)_43];

The forwprop pass tries to forward propgate the &MEM[base: _5, offset: 0B] to 
the base of the MEM  [(int *)_43]. Thus, we get a gimple 
statement as follows:

vect__2.7_24 = MEM  [(int *)&MEM[base: _5, offset: 0B]];

As the &MEM[base: _5, offset: 0B] is a ADDR_EXPR as well as a invalid address 
for gimple MEM_REF, ICE triggers in function maybe_canonicalize_mem_ref_addr at 
gcc/gimple-fold.c:4899 as follows:

gcc_checking_assert (TREE_CODE (TREE_OPERAND (*t, 0)) == DEBUG_EXPR_DECL
   || is_gimple_mem_ref_addr (TREE_OPERAND (*t, 0)));

where *t is the MEM  [(int *)&MEM[base: _5, offset: 0B]] at that 
time.

A simple solution is to add a check before forward propgating a ADDR_EXPR to a 
MEM_REF.

Attached please find the proposed patch.

Newly add test fail without the patch and pass after applying the patch.

Bootstrap and tested on aarch64 and x86 Linux platform. No new regression 
witnessed.

Any suggestion?  
Thanks,
Qian Chao

Log:
+2020-03-23  Qian chao  
+
+   PR c/94266
+   * gcc/tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Add check 
before forward propgating ADDR_EXPR to the operand of MEM_REF.

gcc/testsuite:
+2020-03-23  Qian chao  
+
+   PR c/94266
+   * gcc.target/aarch64/pr94266.c:New test.


pr94266-v0.patch
Description: pr94266-v0.patch


[PATCH PR95569] ICE in tmmark:verify_ssa failed

2020-06-09 Thread qianchao
Hi

Commit eb72dc663e9070b281be83a80f6f838a3a878822 introduces a ICE on AArch64. 
See the discussion on the bug for details.
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95569

Trivial patch fixing the ICE attached.

Bootstrap and tested on aarch64 platform. No new regression witnessed. ok for 
trunk?

2020-06-09  Qian Chao  

gcc/:

PR tree-optimization/95569
* trans-mem.c (expand_assign_tm): Ensure that rtmp is marked 
TREE_ADDRESSABLE.
* testsuite/gcc.dg/tm/pr51472.c: New test.


PR95569-v0.patch
Description: PR95569-v0.patch


RE: [PATCH PR95569] ICE in tmmark:verify_ssa failed

2020-06-09 Thread qianchao
Thanks for reviewing this. Could you please help install this patch?

Thanks,
Qian Chao.

> -Original Message-
> From: Richard Biener [mailto:richard.guent...@gmail.com]
> Sent: Tuesday, June 9, 2020 8:56 PM
> To: qianchao 
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH PR95569] ICE in tmmark:verify_ssa failed
> 
> On Tue, Jun 9, 2020 at 11:47 AM qianchao  wrote:
> >
> > Hi
> >
> > Commit eb72dc663e9070b281be83a80f6f838a3a878822 introduces a ICE on
> AArch64. See the discussion on the bug for details.
> > Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95569
> >
> > Trivial patch fixing the ICE attached.
> >
> > Bootstrap and tested on aarch64 platform. No new regression witnessed. ok 
> > for trunk?
>
> OK.
> 
> Thanks,
> Richard.
> 
> > 2020-06-09  Qian Chao  
> >
> > gcc/:
> >
> > PR tree-optimization/95569
> > * trans-mem.c (expand_assign_tm): Ensure that rtmp is marked
> TREE_ADDRESSABLE.
> > * testsuite/gcc.dg/tm/pr51472.c: New test.


RE: [PATCH PR95569] ICE in tmmark:verify_ssa failed

2020-06-10 Thread qianchao
Thanks for reviewing this. 'git gcc-verify' is OK now. please help install this 
patch.

Thanks,
Qian Chao

> -Original Message-
> From: Martin Liška [mailto:mli...@suse.cz]
> Sent: Wednesday, June 10, 2020 2:49 PM
> To: qianchao ; Richard Biener
> 
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH PR95569] ICE in tmmark:verify_ssa failed
> 
> On 6/10/20 3:10 AM, qianchao wrote:
> > Thanks for reviewing this. Could you please help install this patch?
> 
> Sure, but the patch can't survive ChangeLog verification script:
> 1) please do not modify ChangeLog files changes, these are generated from git
> commit message: https://gcc.gnu.org/codingconventions.html#ChangeLogs
> 
> 2) I recommend using ./contrib/mklog.py in order to generate changes
> template
> 
> 3) You mentioned 'pr51472.c: New file' but the patch adds a different file.
> 
> 4) Please use 'git gcc-verify' which is alias
> to ./contrib/gcc-changelog/git_check_commit.py
> 
> 5) Please ask for write access for the next time:
> https://sourceware.org/cgi-bin/pdw/ps_form.cgi
> You can add me as a person who will approve account creation.
> 
> Thanks,
> Martin


PR95569-v1.patch
Description: PR95569-v1.patch