1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-unknown-unknown -O1 -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @f0
3*f4a2713aSLionel Sambuc // CHECK:   ret i32 1
4*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @f1
5*f4a2713aSLionel Sambuc // CHECK:   ret i32 1
6*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @f2
7*f4a2713aSLionel Sambuc // CHECK:   ret i32 1
8*f4a2713aSLionel Sambuc // <rdr://6115726>
9*f4a2713aSLionel Sambuc 
f0()10*f4a2713aSLionel Sambuc int f0() {
11*f4a2713aSLionel Sambuc   int x;
12*f4a2713aSLionel Sambuc   unsigned short n = 1;
13*f4a2713aSLionel Sambuc   int *a = &x;
14*f4a2713aSLionel Sambuc   int *b = &x;
15*f4a2713aSLionel Sambuc   a = a - n;
16*f4a2713aSLionel Sambuc   b -= n;
17*f4a2713aSLionel Sambuc   return a == b;
18*f4a2713aSLionel Sambuc }
19*f4a2713aSLionel Sambuc 
f1(int * a)20*f4a2713aSLionel Sambuc int f1(int *a) {
21*f4a2713aSLionel Sambuc   long b = a - (int*) 1;
22*f4a2713aSLionel Sambuc   a -= (int*) 1;
23*f4a2713aSLionel Sambuc   return b == (long) a;
24*f4a2713aSLionel Sambuc }
25*f4a2713aSLionel Sambuc 
f2(long n)26*f4a2713aSLionel Sambuc int f2(long n) {
27*f4a2713aSLionel Sambuc   int *b = n + (int*) 1;
28*f4a2713aSLionel Sambuc   n += (int*) 1;
29*f4a2713aSLionel Sambuc   return b == (int*) n;
30*f4a2713aSLionel Sambuc }
31*f4a2713aSLionel Sambuc 
32