2012-02-23 01:37:52 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z2fni
|
2012-02-23 01:37:52 +08:00
|
|
|
void fn(int n) {
|
|
|
|
// CHECK: icmp ult i{{32|64}} %{{[^ ]+}}, 3
|
|
|
|
// CHECK: store i32 1
|
|
|
|
// CHECK: store i32 2
|
|
|
|
// CHECK: store i32 3
|
2014-06-03 14:58:52 +08:00
|
|
|
// CHECK: sub {{.*}}, 12
|
|
|
|
// CHECK: call void @llvm.memset
|
2012-02-23 01:37:52 +08:00
|
|
|
new int[n] { 1, 2, 3 };
|
|
|
|
}
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z15const_underflowv
|
2012-02-23 01:37:52 +08:00
|
|
|
void const_underflow() {
|
|
|
|
// CHECK-NOT: icmp ult i{{32|64}} %{{[^ ]+}}, 3
|
2016-04-08 05:46:12 +08:00
|
|
|
// CHECK: call i8* @_Zna{{.}}(i{{32|64}} -1)
|
2012-02-23 01:37:52 +08:00
|
|
|
new int[2] { 1, 2, 3 };
|
|
|
|
}
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z11const_exactv
|
2012-02-23 01:37:52 +08:00
|
|
|
void const_exact() {
|
|
|
|
// CHECK-NOT: icmp ult i{{32|64}} %{{[^ ]+}}, 3
|
|
|
|
// CHECK-NOT: icmp eq i32*
|
|
|
|
new int[3] { 1, 2, 3 };
|
|
|
|
}
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z16const_sufficientv
|
2012-02-23 01:37:52 +08:00
|
|
|
void const_sufficient() {
|
|
|
|
// CHECK-NOT: icmp ult i{{32|64}} %{{[^ ]+}}, 3
|
|
|
|
new int[4] { 1, 2, 3 };
|
|
|
|
// CHECK: ret void
|
|
|
|
}
|
2014-06-03 14:58:52 +08:00
|
|
|
|
|
|
|
// CHECK-LABEL: define void @_Z22check_array_value_initv
|
|
|
|
void check_array_value_init() {
|
|
|
|
struct S;
|
|
|
|
new (int S::*[3][4][5]) ();
|
|
|
|
|
2016-04-08 05:46:12 +08:00
|
|
|
// CHECK: call i8* @_Zna{{.}}(i{{32 240|64 480}})
|
2015-02-28 03:18:17 +08:00
|
|
|
// CHECK: getelementptr inbounds i{{32|64}}, i{{32|64}}* {{.*}}, i{{32|64}} 60
|
2014-06-03 14:58:52 +08:00
|
|
|
|
|
|
|
// CHECK: phi
|
|
|
|
// CHECK: store i{{32|64}} -1,
|
2015-02-28 03:18:17 +08:00
|
|
|
// CHECK: getelementptr inbounds i{{32|64}}, i{{32|64}}* {{.*}}, i{{32|64}} 1
|
2014-06-03 14:58:52 +08:00
|
|
|
// CHECK: icmp eq
|
|
|
|
// CHECK: br i1
|
|
|
|
}
|