1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - -O3 -no-struct-path-tbaa | FileCheck %s 2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - -O3 | FileCheck %s --check-prefix=PATH 3*f4a2713aSLionel Sambuc f0(int n)4*f4a2713aSLionel Sambucstatic int f0(int n) { 5*f4a2713aSLionel Sambuc struct s0 { 6*f4a2713aSLionel Sambuc int a : 30; 7*f4a2713aSLionel Sambuc int b : 2; 8*f4a2713aSLionel Sambuc long long c : 31; 9*f4a2713aSLionel Sambuc } x = { 0xdeadbeef, 0xdeadbeef, 0xdeadbeef }; 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc x.a += n; 12*f4a2713aSLionel Sambuc x.b += n; 13*f4a2713aSLionel Sambuc x.c += n; 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc return x.a + x.b + x.c; 16*f4a2713aSLionel Sambuc } 17*f4a2713aSLionel Sambuc g0(void)18*f4a2713aSLionel Sambucint g0(void) { 19*f4a2713aSLionel Sambuc // CHECK-LABEL: @g0() 20*f4a2713aSLionel Sambuc // CHECK: ret i32 1 21*f4a2713aSLionel Sambuc // PATH-LABEL: @g0() 22*f4a2713aSLionel Sambuc // PATH: ret i32 1 23*f4a2713aSLionel Sambuc return f0(-1) + 44335655; 24*f4a2713aSLionel Sambuc } 25*f4a2713aSLionel Sambuc f1(void)26*f4a2713aSLionel Sambucstatic int f1(void) { 27*f4a2713aSLionel Sambuc struct s1 { 28*f4a2713aSLionel Sambuc int a:13; 29*f4a2713aSLionel Sambuc char b; 30*f4a2713aSLionel Sambuc unsigned short c:7; 31*f4a2713aSLionel Sambuc } x; 32*f4a2713aSLionel Sambuc 33*f4a2713aSLionel Sambuc x.a = -40; 34*f4a2713aSLionel Sambuc x.b = 10; 35*f4a2713aSLionel Sambuc x.c = 15; 36*f4a2713aSLionel Sambuc 37*f4a2713aSLionel Sambuc return x.a + x.b + x.c; 38*f4a2713aSLionel Sambuc } 39*f4a2713aSLionel Sambuc g1(void)40*f4a2713aSLionel Sambucint g1(void) { 41*f4a2713aSLionel Sambuc // CHECK-LABEL: @g1() 42*f4a2713aSLionel Sambuc // CHECK: ret i32 1 43*f4a2713aSLionel Sambuc // PATH-LABEL: @g1() 44*f4a2713aSLionel Sambuc // PATH: ret i32 1 45*f4a2713aSLionel Sambuc return f1() + 16; 46*f4a2713aSLionel Sambuc } 47*f4a2713aSLionel Sambuc f2(void)48*f4a2713aSLionel Sambucstatic int f2(void) { 49*f4a2713aSLionel Sambuc struct s2 { 50*f4a2713aSLionel Sambuc short a[3]; 51*f4a2713aSLionel Sambuc int b : 15; 52*f4a2713aSLionel Sambuc } x; 53*f4a2713aSLionel Sambuc 54*f4a2713aSLionel Sambuc x.a[0] = x.a[1] = x.a[2] = -40; 55*f4a2713aSLionel Sambuc x.b = 10; 56*f4a2713aSLionel Sambuc 57*f4a2713aSLionel Sambuc return x.b; 58*f4a2713aSLionel Sambuc } 59*f4a2713aSLionel Sambuc g2(void)60*f4a2713aSLionel Sambucint g2(void) { 61*f4a2713aSLionel Sambuc // CHECK-LABEL: @g2() 62*f4a2713aSLionel Sambuc // CHECK: ret i32 1 63*f4a2713aSLionel Sambuc // PATH-LABEL: @g2() 64*f4a2713aSLionel Sambuc // PATH: ret i32 1 65*f4a2713aSLionel Sambuc return f2() - 9; 66*f4a2713aSLionel Sambuc } 67*f4a2713aSLionel Sambuc f3(int n)68*f4a2713aSLionel Sambucstatic int f3(int n) { 69*f4a2713aSLionel Sambuc struct s3 { 70*f4a2713aSLionel Sambuc unsigned a:16; 71*f4a2713aSLionel Sambuc unsigned b:28 __attribute__ ((packed)); 72*f4a2713aSLionel Sambuc } x = { 0xdeadbeef, 0xdeadbeef }; 73*f4a2713aSLionel Sambuc struct s4 { 74*f4a2713aSLionel Sambuc signed a:16; 75*f4a2713aSLionel Sambuc signed b:28 __attribute__ ((packed)); 76*f4a2713aSLionel Sambuc } y; 77*f4a2713aSLionel Sambuc y.a = -0x56789abcL; 78*f4a2713aSLionel Sambuc y.b = -0x56789abcL; 79*f4a2713aSLionel Sambuc return ((y.a += x.a += n) + 80*f4a2713aSLionel Sambuc (y.b += x.b += n)); 81*f4a2713aSLionel Sambuc } 82*f4a2713aSLionel Sambuc g3(void)83*f4a2713aSLionel Sambucint g3(void) { 84*f4a2713aSLionel Sambuc // CHECK-LABEL: @g3() 85*f4a2713aSLionel Sambuc // CHECK: ret i32 1 86*f4a2713aSLionel Sambuc // PATH-LABEL: @g3() 87*f4a2713aSLionel Sambuc // PATH: ret i32 1 88*f4a2713aSLionel Sambuc return f3(20) + 130725747; 89*f4a2713aSLionel Sambuc } 90