This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tree-ssa] Simple value range propagation for tree-ssa-dom


I was hoping that this would cause redundant checks like this to be
removed:

int a[10];

int foo ()
{
  int j;
  int m=0;
  for (j=0; j<10;j++)
    {
      if (j < 0)
	abort();
      if (j > 10)
	abort();
      m+=a[j];
    }
  return m;
}

But it doesn't seem to work:

foo:
	subl	$12, %esp
	xorl	%eax, %eax
	xorl	%edx, %edx
	.p2align 4,,15
.L3:
	testl	%edx, %edx
	js	.L9
	movl	a(,%edx,4), %ecx
	incl	%edx
	addl	%ecx, %eax
	cmpl	$9, %edx
	jle	.L3
	addl	$12, %esp
	ret
.L9:
	call	abort

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]