summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/loop-8.c
blob: bedfa5d1ac427acef1d2f59a769227901a47991e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-rtl-loop2_invariant" } */

void
f (int *a, int *b)
{
  int i;

  for (i = 0; i < 100; i++)
    {
      int d = 42;

      a[i] = d;
      if (i % 2)
	d = i;
      b[i] = d;
    }
}

/* Load of 42 is moved out of the loop, introducing a new pseudo register.  */
/* { dg-final { scan-rtl-dump-times "Decided" 1 "loop2_invariant" } } */
/* { dg-final { scan-rtl-dump-not "without introducing a new temporary register" "loop2_invariant" } } */