locals_opt_default.rs revision 5ef635994356a16ede6d0fd450cb7f8fba14a8a0
1// RUN: %Slang %s
2// RUN: %rs-filecheck-wrapper %s
3// CHECK-NOT: define internal i32 @main(
4// CHECK-NOT: %f = alloca float,
5// CHECK-NOT: %pf = alloca float*,
6// CHECK-NOT: %ppn = alloca i32**,
7
8// This test case should behave identically to locals_opt_3.rs.
9
10struct float_struct {
11  float f;
12  float f2[2];
13} compound_float;
14
15
16static
17int main(int argc, char* argv[])
18{
19  float f = 0.f;
20  float *pf = &f;
21
22  double d[2][2] = {{0, 1}, {2, 3.0}};
23  struct float_struct s;
24
25  unsigned short us = -1;
26  const unsigned long l = (unsigned long) -1.0e8f;
27
28  {
29    int** ppn = 0;
30    if (ppn) {
31      return -1;
32    }
33  }
34
35  s.f = 10e-4f;
36  s.f2[0] = 1e4f;
37  s.f2[1] = 100.5f;
38
39  double result = pf[0] * d[1][1] * s.f * us * l;
40  return (result == 0 ? 0 : -1);
41}
42
43void the_main() {
44  main(0, 0);
45}
46
47#pragma version(1)
48#pragma rs java_package_name(foo)
49