Commit 653a4b32 by Bin Cheng Committed by Bin Cheng

re PR tree-optimization/66768 (address space gets lost on literal pointer)

	PR tree-optimization/66768
	* tree-ssa-loop-ivopts.c (find_interesting_uses_address): Skip addr
	iv_use if base object can't be determined.

	gcc/testsuite
	* gcc.target/i386/pr66768.c: New test.

From-SVN: r245837
parent 6d03bdcc
2017-03-02 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/66768
* tree-ssa-loop-ivopts.c (find_interesting_uses_address): Skip addr
iv_use if base object can't be determined.
2017-03-02 Jakub Jelinek <jakub@redhat.com> 2017-03-02 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/79345 PR tree-optimization/79345
......
2017-03-02 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/66768
* gcc.target/i386/pr66768.c: New test.
2017-03-02 Richard Biener <rguenther@suse.de> 2017-03-02 Richard Biener <rguenther@suse.de>
* gcc.dg/rtl/x86_64/dfinit.c: Only run for lp64. * gcc.dg/rtl/x86_64/dfinit.c: Only run for lp64.
......
/* { dg-do compile } */
/* { dg-options "-O2" } */
typedef __seg_gs struct foo_s {
int a[20];
} foo_t;
int sum(void)
{
const foo_t *p = (const foo_t *)0x1234;
int i, total=0;
for (i=0; i<20; i++)
total += p->a[i];
return total;
}
/* { dg-final { scan-assembler "add*.\[ \t\]%gs:" } } */
...@@ -2324,6 +2324,10 @@ find_interesting_uses_address (struct ivopts_data *data, gimple *stmt, ...@@ -2324,6 +2324,10 @@ find_interesting_uses_address (struct ivopts_data *data, gimple *stmt,
} }
civ = alloc_iv (data, base, step); civ = alloc_iv (data, base, step);
/* Fail if base object of this memory reference is unknown. */
if (civ->base_object == NULL_TREE)
goto fail;
record_group_use (data, op_p, civ, stmt, USE_ADDRESS); record_group_use (data, op_p, civ, stmt, USE_ADDRESS);
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment