public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH Obvious/r236200]Check invariant expression pointer, not pointer to the pointer
@ 2016-05-18 10:35 Bin Cheng
  0 siblings, 0 replies; only message in thread
From: Bin Cheng @ 2016-05-18 10:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

Hi,
Revision 236200 checks wrong pointer for invariant expression, which accidentally clears all depends_on information.  This causes wrong cost and bad code generation, for example, gcc.target/arm/pr42505.c on thumb1 targets.  This patch fixes the issue.
Test result checked for gcc.target/arm/pr42505.c.  Apply as obvious.

Thanks,
bin

2016-05-18 Bin Cheng  <bin.cheng@arm.com>

	* tree-ssa-loop-ivopts.c (get_computation_cost_at): Check invariant
	expression pointer, not pointer to the pointer.

[-- Attachment #2: fix-inv_expr-checking-in_ivopt.txt --]
[-- Type: text/plain, Size: 460 bytes --]

diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index e8953a0..9ce6b64 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -4874,7 +4874,7 @@ get_computation_cost_at (struct ivopts_data *data,
       *inv_expr = get_loop_invariant_expr (data, ubase, cbase, ratio,
 					   address_p);
       /* Clear depends on.  */
-      if (inv_expr != NULL)
+      if (*inv_expr != NULL)
 	bitmap_clear (*depends_on);
     }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-18 10:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18 10:35 [PATCH Obvious/r236200]Check invariant expression pointer, not pointer to the pointer Bin Cheng

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).