// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s -fsanitize=signed-integer-overflow,unsigned-integer-overflow | FileCheck %s
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef int int4 ;
;
;
// CHECK-LABEL: define{{.*}} signext i8 @_Z4add1
// CHECK-NOT: sadd.with.overflow
char
// CHECK-LABEL: define{{.*}} zeroext i8 @_Z4add2
// CHECK-NOT: uadd.with.overflow
uchar
// CHECK-LABEL: define{{.*}} i32 @_Z4add3
// CHECK: sadd.with.overflow
int
// CHECK-LABEL: define{{.*}} signext i8 @_Z4add4
// CHECK-NOT: sadd.with.overflow
char
// CHECK-LABEL: define{{.*}} signext i8 @_Z4sub1
// CHECK-NOT: ssub.with.overflow
char
// CHECK-LABEL: define{{.*}} zeroext i8 @_Z4sub2
// CHECK-NOT: usub.with.overflow
uchar
// CHECK-LABEL: define{{.*}} signext i8 @_Z4sub3
// CHECK-NOT: ssub.with.overflow
char
// Note: -INT_MIN can overflow.
//
// CHECK-LABEL: define{{.*}} i32 @_Z4sub4
// CHECK: ssub.with.overflow
int
// CHECK-LABEL: define{{.*}} signext i8 @_Z4mul1
// CHECK-NOT: smul.with.overflow
char
// CHECK-LABEL: define{{.*}} zeroext i8 @_Z4mul2
// CHECK-NOT: smul.with.overflow
uchar
// Note: USHRT_MAX * USHRT_MAX can overflow.
//
// CHECK-LABEL: define{{.*}} zeroext i16 @_Z4mul3
// CHECK: smul.with.overflow
ushort
// CHECK-LABEL: define{{.*}} i32 @_Z4mul4
// CHECK: smul.with.overflow
int
// CHECK-LABEL: define{{.*}} i32 @_Z4mul5
// CHECK: smul.with.overflow
int
// CHECK-LABEL: define{{.*}} signext i16 @_Z4mul6
// CHECK-NOT: smul.with.overflow
short
// CHECK-LABEL: define{{.*}} signext i8 @_Z4div1
// CHECK-NOT: ubsan_handle_divrem_overflow
char
// CHECK-LABEL: define{{.*}} zeroext i8 @_Z4div2
// CHECK-NOT: ubsan_handle_divrem_overflow
uchar
// CHECK-LABEL: define{{.*}} signext i8 @_Z4div3
// CHECK-NOT: ubsan_handle_divrem_overflow
char
// CHECK-LABEL: define{{.*}} signext i8 @_Z4div4
// CHECK: ubsan_handle_divrem_overflow
char
// Note: INT_MIN / -1 can overflow.
//
// CHECK-LABEL: define{{.*}} signext i8 @_Z4div5
// CHECK: ubsan_handle_divrem_overflow
char
// CHECK-LABEL: define{{.*}} signext i8 @_Z4rem1
// CHECK-NOT: ubsan_handle_divrem_overflow
char
// CHECK-LABEL: define{{.*}} zeroext i8 @_Z4rem2
// CHECK-NOT: ubsan_handle_divrem_overflow
uchar
// CHECK-LABEL: define{{.*}} signext i8 @_Z4rem3
// CHECK: ubsan_handle_divrem_overflow
char
// CHECK-LABEL: define{{.*}} signext i8 @_Z4rem4
// CHECK-NOT: ubsan_handle_divrem_overflow
char
// CHECK-LABEL: define{{.*}} signext i8 @_Z4inc1
// CHECK-NOT: sadd.with.overflow
char
// CHECK-LABEL: define{{.*}} zeroext i8 @_Z4inc2
// CHECK-NOT: uadd.with.overflow
uchar
// CHECK-LABEL: define{{.*}} void @_Z4inc3
// CHECK-NOT: sadd.with.overflow
void
// CHECK-LABEL: define{{.*}} void @_Z4inc4
// CHECK-NOT: uadd.with.overflow
void
// CHECK-LABEL: define{{.*}} <4 x i32> @_Z4vremDv4_iS_
// CHECK-NOT: ubsan_handle_divrem_overflow
int4