
Since C++11, the C++ standard has a forward progress guarantee [intro.progress], so all such functions must have the `mustprogress` requirement. In addition, from C11 and onwards, loops without a non-zero constant conditional or no conditional are also required to make progress (C11 6.8.5p6). This patch implements these attribute deductions so they can be used by the optimization passes. Differential Revision: https://reviews.llvm.org/D86841
26 lines
988 B
C++
26 lines
988 B
C++
// RUN: %clang_cc1 -std=c++11 -S -emit-llvm -o %t-c++11.ll %s -triple x86_64-apple-darwin10
|
|
// RUN: FileCheck %s < %t-c++11.ll
|
|
// RUN: %clang_cc1 -std=c++17 -S -emit-llvm -o %t-c++17.ll %s -triple x86_64-apple-darwin10
|
|
// RUN: FileCheck %s < %t-c++17.ll
|
|
// RUN: %clang_cc1 -std=c++98 -S -emit-llvm -o %t.ll %s -triple x86_64-apple-darwin10
|
|
// RUN: %clang_cc1 -std=c++03 -S -emit-llvm -o %t-c++03.ll %s -triple x86_64-apple-darwin10
|
|
// RUN: diff %t-c++11.ll %t-c++17.ll
|
|
// RUN: diff %t.ll %t-c++03.ll
|
|
|
|
// rdar://12897704
|
|
|
|
struct sAFSearchPos {
|
|
unsigned char *pos;
|
|
unsigned char count;
|
|
};
|
|
|
|
static volatile struct sAFSearchPos testPositions;
|
|
// CHECK: @_ZL13testPositions = internal global %struct.sAFSearchPos zeroinitializer
|
|
|
|
static volatile struct sAFSearchPos arrayPositions[100][10][5];
|
|
// CHECK: @_ZL14arrayPositions = internal global [100 x [10 x [5 x %struct.sAFSearchPos]]] zeroinitializer
|
|
|
|
int main() {
|
|
return testPositions.count + arrayPositions[10][4][3].count;
|
|
}
|