[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / 2008-07-31-promotion-of-compound-pointer-arithmetic.c
blobb503677214c455a6a94c1442ad5ed31c59b76f25
1 // RUN: %clang_cc1 -triple i386-unknown-unknown -O1 -Wno-int-conversion -emit-llvm -o - %s | FileCheck %s
2 // CHECK-LABEL: define{{.*}} i32 @f0
3 // CHECK: ret i32 1
4 // CHECK-LABEL: define{{.*}} i32 @f1
5 // CHECK: ret i32 1
6 // CHECK-LABEL: define{{.*}} i32 @f2
7 // CHECK: ret i32 1
8 // <rdr://6115726>
10 int f0(void) {
11 int x;
12 unsigned short n = 1;
13 int *a = &x;
14 int *b = &x;
15 a = a - n;
16 b -= n;
17 return a == b;
20 int f1(int *a) {
21 long b = a - (int*) 1;
22 a -= (int*) 1;
23 return b == (long) a;
26 int f2(long n) {
27 int *b = n + (int*) 1;
28 n += (int*) 1;
29 return b == (int*) n;