PR c++/37276
[official-gcc.git] / gcc / testsuite / gcc.dg / hoist-register-pressure-3.c
blobbea8bd40110c8220a4a7c164cdbb97e50da75c36
1 /* { dg-options "-Os -fdump-rtl-hoist" } */
2 /* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" "hoist" } } */
4 #define BUF 100
5 int a[BUF];
7 void com (int);
8 void bar (int);
10 int foo (int x, int y, int z)
12 /* "x+y" won't be hoisted if "-fira-hoist-pressure" is disabled,
13 because its rtx_cost is too small. */
14 if (z)
16 a[1] = a[0] + a[2] + a[3] + a[4] + a[5] + a[6];
17 a[2] = a[1] + a[3] + a[5] + a[5] + a[6] + a[7];
18 a[3] = a[2] + a[5] + a[7] + a[6] + a[7] + a[8];
19 a[4] = a[3] + a[7] + a[11] + a[7] + a[8] + a[9];
20 a[5] = a[5] + a[11] + a[13] + a[8] + a[9] + a[10];
21 a[6] = a[7] + a[13] + a[17] + a[9] + a[10] + a[11];
22 a[7] = a[11] + a[17] + a[19] + a[10] + a[11] + a[12];
23 com (x+y);
25 else
27 bar (x+y);
30 return 0;