Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -triple i386-unknown-unknown -O1 -emit-llvm -o - %s | FileCheck %s
      2 // CHECK: define i32 @f0
      3 // CHECK:   ret i32 1
      4 // CHECK: define i32 @f1
      5 // CHECK:   ret i32 1
      6 // CHECK: define i32 @f2
      7 // CHECK:   ret i32 1
      8 // <rdr://6115726>
      9 
     10 int f0() {
     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;
     18 }
     19 
     20 int f1(int *a) {
     21   long b = a - (int*) 1;
     22   a -= (int*) 1;
     23   return b == (long) a;
     24 }
     25 
     26 int f2(long n) {
     27   int *b = n + (int*) 1;
     28   n += (int*) 1;
     29   return b == (int*) n;
     30 }
     31 
     32