aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr92712-2.c
blob: 2710ff36cc1bca10a2c9bcab83c55611b19be8e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* PR tree-optimization/92712 */
/* { dg-do compile } */
/* { dg-options "-O2 -fno-ipa-icf -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump-times " = \[tv]_\[0-9]*\\\(D\\\) \\* \[tv]_\[0-9]*\\\(D\\\);" 7 "optimized" } } */

int
f1 (int t, int v)
{
  int a = t - 1;
  int b = a * v;
  return b + v;
}

int
f2 (int t, int v)
{
  int a = t - 1;
  int b = a * v;
  return v + b;
}

int
f3 (int t, int v)
{
  int a = t + 1;
  int b = a * v;
  return b - v;
}

int
f4 (int t, int v)
{
  int a = 1 - t;
  int b = a * v;
  return v - b;
}

int
f5 (int t, int v)
{
  if (v == 0 || v == -1)
    __builtin_unreachable ();
  int a = t - 1U;
  int b = a * v;
  return b + v;
}

int
f6 (int t, int v)
{
  if (v == 0 || v == -1)
    __builtin_unreachable ();
  int a = t - 1U;
  int b = a * v;
  return v + b;
}

int
f7 (int t, int v)
{
  if (v == 0)
    __builtin_unreachable ();
  int a = t + 1U;
  int b = a * v;
  return b - v;
}