[clang] fb4d8fe - [clang] Update mustprogress tests.
Florian Hahn via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 12 08:54:55 PST 2021
Author: Florian Hahn
Date: 2021-02-12T16:53:51Z
New Revision: fb4d8fe807016fed221263d9a406e3856c8dfa4c
URL: https://github.com/llvm/llvm-project/commit/fb4d8fe807016fed221263d9a406e3856c8dfa4c
DIFF: https://github.com/llvm/llvm-project/commit/fb4d8fe807016fed221263d9a406e3856c8dfa4c.diff
LOG: [clang] Update mustprogress tests.
This unifies the positive and negative tests in a single file and
manually adjusts the check lines to check for differences surgically.
Added:
clang/test/CodeGen/attr-mustprogress.c
clang/test/CodeGenCXX/attr-mustprogress.cpp
Modified:
Removed:
clang/test/CodeGen/attr-mustprogress-0.c
clang/test/CodeGen/attr-mustprogress-0.cpp
clang/test/CodeGen/attr-mustprogress-1.c
clang/test/CodeGen/attr-mustprogress-1.cpp
################################################################################
diff --git a/clang/test/CodeGen/attr-mustprogress-0.c b/clang/test/CodeGen/attr-mustprogress-0.c
deleted file mode 100644
index 2af24e88ceef..000000000000
--- a/clang/test/CodeGen/attr-mustprogress-0.c
+++ /dev/null
@@ -1,184 +0,0 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes
-// RUN: %clang_cc1 -std=c89 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-// RUN: %clang_cc1 -std=c99 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-
-int a = 0;
-int b = 0;
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @f1(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
-// CHECK: for.cond:
-// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
-// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]]
-// CHECK: for.end:
-// CHECK-NEXT: ret void
-//
-void f1() {
- for (; 1;) {
- }
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @f2(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
-// CHECK: for.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
-// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]]
-// CHECK: for.end:
-// CHECK-NEXT: ret void
-//
-void f2() {
- for (; a == b;) {
- }
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @F(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
-// CHECK: for.cond:
-// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
-// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]]
-// CHECK: for.end:
-// CHECK-NEXT: br label [[FOR_COND1:%.*]]
-// CHECK: for.cond1:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY2:%.*]], label [[FOR_END3:%.*]]
-// CHECK: for.body2:
-// CHECK-NEXT: br label [[FOR_COND1]]
-// CHECK: for.end3:
-// CHECK-NEXT: ret void
-//
-void F() {
- for (; 1;) {
- }
- for (; a == b;) {
- }
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @w1(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[WHILE_BODY:%.*]]
-// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_BODY]]
-//
-void w1() {
- while (1) {
- }
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @w2(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[WHILE_COND:%.*]]
-// CHECK: while.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]]
-// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_COND]]
-// CHECK: while.end:
-// CHECK-NEXT: ret void
-//
-void w2() {
- while (a == b) {
- }
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @W(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[WHILE_COND:%.*]]
-// CHECK: while.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]]
-// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_COND]]
-// CHECK: while.end:
-// CHECK-NEXT: br label [[WHILE_BODY2:%.*]]
-// CHECK: while.body2:
-// CHECK-NEXT: br label [[WHILE_BODY2]]
-//
-void W() {
- while (a == b) {
- }
- while (1) {
- }
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @d1(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
-// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
-// CHECK: do.cond:
-// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]]
-// CHECK: do.end:
-// CHECK-NEXT: ret void
-//
-void d1() {
- do {
- } while (1);
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @d2(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
-// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
-// CHECK: do.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY]], label [[DO_END:%.*]]
-// CHECK: do.end:
-// CHECK-NEXT: ret void
-//
-void d2() {
- do {
- } while (a == b);
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @D(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
-// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
-// CHECK: do.cond:
-// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]]
-// CHECK: do.end:
-// CHECK-NEXT: br label [[DO_BODY1:%.*]]
-// CHECK: do.body1:
-// CHECK-NEXT: br label [[DO_COND2:%.*]]
-// CHECK: do.cond2:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY1]], label [[DO_END3:%.*]]
-// CHECK: do.end3:
-// CHECK-NEXT: ret void
-//
-void D() {
- do {
- } while (1);
- do {
- } while (a == b);
-}
diff --git a/clang/test/CodeGen/attr-mustprogress-0.cpp b/clang/test/CodeGen/attr-mustprogress-0.cpp
deleted file mode 100644
index 3a180cc6b5ad..000000000000
--- a/clang/test/CodeGen/attr-mustprogress-0.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes
-// RUN: %clang_cc1 -std=c++98 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-
-int a = 0;
-int b = 0;
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2f1v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
-// CHECK: for.cond:
-// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
-// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]]
-// CHECK: for.end:
-// CHECK-NEXT: ret void
-//
-void f1() {
- for (; 1;) {
- }
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2f2v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
-// CHECK: for.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
-// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]]
-// CHECK: for.end:
-// CHECK-NEXT: ret void
-//
-void f2() {
- for (; a == b;) {
- }
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z1Fv(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
-// CHECK: for.cond:
-// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
-// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]]
-// CHECK: for.end:
-// CHECK-NEXT: br label [[FOR_COND1:%.*]]
-// CHECK: for.cond1:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY2:%.*]], label [[FOR_END3:%.*]]
-// CHECK: for.body2:
-// CHECK-NEXT: br label [[FOR_COND1]]
-// CHECK: for.end3:
-// CHECK-NEXT: ret void
-//
-void F() {
- for (; 1;) {
- }
- for (; a == b;) {
- }
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2w1v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[WHILE_BODY:%.*]]
-// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_BODY]]
-//
-void w1() {
- while (1) {
- }
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2w2v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[WHILE_COND:%.*]]
-// CHECK: while.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]]
-// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_COND]]
-// CHECK: while.end:
-// CHECK-NEXT: ret void
-//
-void w2() {
- while (a == b) {
- }
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z1Wv(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[WHILE_COND:%.*]]
-// CHECK: while.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]]
-// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_COND]]
-// CHECK: while.end:
-// CHECK-NEXT: br label [[WHILE_BODY2:%.*]]
-// CHECK: while.body2:
-// CHECK-NEXT: br label [[WHILE_BODY2]]
-//
-void W() {
- while (a == b) {
- }
- while (1) {
- }
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2d1v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
-// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
-// CHECK: do.cond:
-// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]]
-// CHECK: do.end:
-// CHECK-NEXT: ret void
-//
-void d1() {
- do {
- } while (1);
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2d2v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
-// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
-// CHECK: do.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY]], label [[DO_END:%.*]]
-// CHECK: do.end:
-// CHECK-NEXT: ret void
-//
-void d2() {
- do {
- } while (a == b);
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z1Dv(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
-// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
-// CHECK: do.cond:
-// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]]
-// CHECK: do.end:
-// CHECK-NEXT: br label [[DO_BODY1:%.*]]
-// CHECK: do.body1:
-// CHECK-NEXT: br label [[DO_COND2:%.*]]
-// CHECK: do.cond2:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY1]], label [[DO_END3:%.*]]
-// CHECK: do.end3:
-// CHECK-NEXT: ret void
-//
-void D() {
- do {
- } while (1);
- do {
- } while (a == b);
-}
diff --git a/clang/test/CodeGen/attr-mustprogress-1.cpp b/clang/test/CodeGen/attr-mustprogress-1.cpp
deleted file mode 100644
index 945d74663c6d..000000000000
--- a/clang/test/CodeGen/attr-mustprogress-1.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes
-// RUN: %clang_cc1 -std=c++11 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-// RUN: %clang_cc1 -std=c++14 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-// RUN: %clang_cc1 -std=c++17 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-// RUN: %clang_cc1 -std=c++20 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-
-int a = 0;
-int b = 0;
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2f0v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
-// CHECK: for.cond:
-// CHECK-NOT: br label [[FOR_COND]], !llvm.loop !{{.*}}
-void f0() {
- for (; ;) ;
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2f1v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
-// CHECK: for.cond:
-// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
-// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]]
-// CHECK: for.end:
-// CHECK-NEXT: ret void
-//
-void f1() {
- for (; 1;)
- ;
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone mustprogress
-// CHECK-LABEL: @_Z2f2v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
-// CHECK: for.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
-// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]], [[LOOP2:!llvm.loop !.*]]
-// CHECK: for.end:
-// CHECK-NEXT: ret void
-//
-void f2() {
- for (; a == b;)
- ;
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z1Fv(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
-// CHECK: for.cond:
-// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
-// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]]
-// CHECK: for.end:
-// CHECK-NEXT: br label [[FOR_COND1:%.*]]
-// CHECK: for.cond1:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY2:%.*]], label [[FOR_END3:%.*]]
-// CHECK: for.body2:
-// CHECK-NEXT: br label [[FOR_COND1]], [[LOOP4:!llvm.loop !.*]]
-// CHECK: for.end3:
-// CHECK-NEXT: ret void
-//
-void F() {
- for (; 1;)
- ;
- for (; a == b;)
- ;
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2F2v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
-// CHECK: for.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
-// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]], [[LOOP5:!llvm.loop !.*]]
-// CHECK: for.end:
-// CHECK-NEXT: br label [[FOR_COND1:%.*]]
-// CHECK: for.cond1:
-// CHECK-NEXT: br i1 true, label [[FOR_BODY2:%.*]], label [[FOR_END3:%.*]]
-// CHECK: for.body2:
-// CHECK-NEXT: br label [[FOR_COND1]]
-// CHECK: for.end3:
-// CHECK-NEXT: ret void
-//
-void F2() {
- for (; a == b;)
- ;
- for (; 1;)
- ;
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2w1v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[WHILE_BODY:%.*]]
-// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_BODY]]
-//
-void w1() {
- while (1)
- ;
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone mustprogress
-// CHECK-LABEL: @_Z2w2v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[WHILE_COND:%.*]]
-// CHECK: while.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]]
-// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_COND]], [[LOOP6:!llvm.loop !.*]]
-// CHECK: while.end:
-// CHECK-NEXT: ret void
-//
-void w2() {
- while (a == b)
- ;
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z1Wv(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[WHILE_COND:%.*]]
-// CHECK: while.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]]
-// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_COND]], [[LOOP7:!llvm.loop !.*]]
-// CHECK: while.end:
-// CHECK-NEXT: br label [[WHILE_BODY2:%.*]]
-// CHECK: while.body2:
-// CHECK-NEXT: br label [[WHILE_BODY2]]
-//
-void W() {
- while (a == b)
- ;
- while (1)
- ;
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2W2v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[WHILE_BODY:%.*]]
-// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_BODY]]
-//
-void W2() {
- while (1)
- ;
- while (a == b)
- ;
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2d1v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
-// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
-// CHECK: do.cond:
-// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]]
-// CHECK: do.end:
-// CHECK-NEXT: ret void
-//
-void d1() {
- do
- ;
- while (1);
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone mustprogress
-// CHECK-LABEL: @_Z2d2v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
-// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
-// CHECK: do.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY]], label [[DO_END:%.*]], [[LOOP8:!llvm.loop !.*]]
-// CHECK: do.end:
-// CHECK-NEXT: ret void
-//
-void d2() {
- do
- ;
- while (a == b);
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z1Dv(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
-// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
-// CHECK: do.cond:
-// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]]
-// CHECK: do.end:
-// CHECK-NEXT: br label [[DO_BODY1:%.*]]
-// CHECK: do.body1:
-// CHECK-NEXT: br label [[DO_COND2:%.*]]
-// CHECK: do.cond2:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY1]], label [[DO_END3:%.*]], [[LOOP9:!llvm.loop !.*]]
-// CHECK: do.end3:
-// CHECK-NEXT: ret void
-//
-void D() {
- do
- ;
- while (1);
- do
- ;
- while (a == b);
-}
-
-// CHECK: Function Attrs: noinline nounwind optnone
-// CHECK-LABEL: @_Z2D2v(
-// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
-// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
-// CHECK: do.cond:
-// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
-// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
-// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY]], label [[DO_END:%.*]], [[LOOP10:!llvm.loop !.*]]
-// CHECK: do.end:
-// CHECK-NEXT: br label [[DO_BODY1:%.*]]
-// CHECK: do.body1:
-// CHECK-NEXT: br label [[DO_COND2:%.*]]
-// CHECK: do.cond2:
-// CHECK-NEXT: br i1 true, label [[DO_BODY1]], label [[DO_END3:%.*]]
-// CHECK: do.end3:
-// CHECK-NEXT: ret void
-//
-void D2() {
- do
- ;
- while (a == b);
- do
- ;
- while (1);
-}
-
diff --git a/clang/test/CodeGen/attr-mustprogress-1.c b/clang/test/CodeGen/attr-mustprogress.c
similarity index 53%
rename from clang/test/CodeGen/attr-mustprogress-1.c
rename to clang/test/CodeGen/attr-mustprogress.c
index 2ff068b8b90a..d1b262d654cd 100644
--- a/clang/test/CodeGen/attr-mustprogress-1.c
+++ b/clang/test/CodeGen/attr-mustprogress.c
@@ -1,31 +1,32 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes
-// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-// RUN: %clang_cc1 -std=c11 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-// RUN: %clang_cc1 -std=c18 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-// RUN: %clang_cc1 -std=c2x -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -std=c99 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=C99 %s
+// RUN: %clang_cc1 -std=c11 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=C11 %s
+// RUN: %clang_cc1 -std=c18 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=C11 %s
+// RUN: %clang_cc1 -std=c2x -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=C11 %s
int a = 0;
int b = 0;
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: datalayout
+//
+// CHECK-NOT: mustprogress
// CHECK-LABEL: @f0(
// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
+// CHECK-NEXT: br label %for.cond
// CHECK: for.cond:
-// CHECK-NOT: br label [[FOR_COND]], !llvm.loop !{{.*}}
+// CHECK-NOT: br {{.*}}!llvm.loop
//
void f0() {
for (; ;) ;
}
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-NOT: mustprogress
// CHECK-LABEL: @f1(
// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
+// CHECK-NEXT: br label %for.cond
// CHECK: for.cond:
-// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
+// CHECK-NEXT: br i1 true, label %for.body, label %for.end
// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]]
+// CHECK-NOT: br {{.*}}, !llvm.loop
// CHECK: for.end:
// CHECK-NEXT: ret void
//
@@ -34,17 +35,18 @@ void f1() {
}
}
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-NOT: mustprogress
// CHECK-LABEL: @f2(
// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
+// CHECK-NEXT: br label %for.cond
// CHECK: for.cond:
// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
+// CHECK-NEXT: br i1 [[CMP]], label %for.body, label %for.end
// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]], [[LOOP2:!llvm.loop !.*]]
+// C99-NOT: br {{.*}} !llvm.loop
+// C11: br label %for.cond, !llvm.loop [[LOOP1:!.*]]
// CHECK: for.end:
// CHECK-NEXT: ret void
//
@@ -53,23 +55,24 @@ void f2() {
}
}
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-NOT: mustprogress
// CHECK-LABEL: @F(
// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[FOR_COND:%.*]]
+// CHECK-NEXT: br label %for.cond
// CHECK: for.cond:
-// CHECK-NEXT: br i1 true, label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
+// CHECK-NEXT: br i1 true, label %for.body, label %for.end
// CHECK: for.body:
-// CHECK-NEXT: br label [[FOR_COND]]
+// CHECK-NOT: br {{.*}}, !llvm.loop
// CHECK: for.end:
-// CHECK-NEXT: br label [[FOR_COND1:%.*]]
+// CHECK-NEXT: br label %for.cond1
// CHECK: for.cond1:
// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY2:%.*]], label [[FOR_END3:%.*]]
+// CHECK-NEXT: br i1 [[CMP]], label %for.body2, label %for.end3
// CHECK: for.body2:
-// CHECK-NEXT: br label [[FOR_COND1]], [[LOOP4:!llvm.loop !.*]]
+// C99-NOT: br {{.*}}, !llvm.loop
+// C11: br label %for.cond1, !llvm.loop [[LOOP2:!.*]]
// CHECK: for.end3:
// CHECK-NEXT: ret void
//
@@ -80,29 +83,29 @@ void F() {
}
}
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-NOT: mustprogress
// CHECK-LABEL: @w1(
// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[WHILE_BODY:%.*]]
+// CHECK-NEXT: br label %while.body
// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_BODY]]
-//
+// CHECK-NOT: br {{.*}}, !llvm.loop
void w1() {
while (1) {
}
}
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-NOT: mustprogress
// CHECK-LABEL: @w2(
// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[WHILE_COND:%.*]]
+// CHECK-NEXT: br label %while.cond
// CHECK: while.cond:
// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]]
+// CHECK-NEXT: br i1 [[CMP]], label %while.body, label %while.end
// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_COND]], [[LOOP5:!llvm.loop !.*]]
+// C11: br label %while.cond, [[LOOP5:!llvm.loop !.*]]
+// C99-NOT: br {{.*}}, !llvm.loop
// CHECK: while.end:
// CHECK-NEXT: ret void
//
@@ -111,7 +114,7 @@ void w2() {
}
}
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-NOT: mustprogress
// CHECK-LABEL: @W(
// CHECK-NEXT: entry:
// CHECK-NEXT: br label [[WHILE_COND:%.*]]
@@ -119,13 +122,14 @@ void w2() {
// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[WHILE_BODY:%.*]], label [[WHILE_END:%.*]]
+// CHECK-NEXT: br i1 [[CMP]], label %while.body, label %while.end
// CHECK: while.body:
-// CHECK-NEXT: br label [[WHILE_COND]], [[LOOP6:!llvm.loop !.*]]
+// C99-NOT: br {{.*}} !llvm.loop
+// C11: br label %while.cond, !llvm.loop [[LOOP3:!.*]]
// CHECK: while.end:
-// CHECK-NEXT: br label [[WHILE_BODY2:%.*]]
+// CHECK-NEXT: br label %while.body2
// CHECK: while.body2:
-// CHECK-NEXT: br label [[WHILE_BODY2]]
+// CHECK-NOT: br {{.*}} !llvm.loop
//
void W() {
while (a == b) {
@@ -134,14 +138,14 @@ void W() {
}
}
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-NOT: mustprogress
// CHECK-LABEL: @d1(
// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
+// CHECK-NEXT: br label %do.body
// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
+// CHECK-NEXT: br label %do.cond
// CHECK: do.cond:
-// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]]
+// CHECK-NOT: br {{.*}}, !llvm.loop
// CHECK: do.end:
// CHECK-NEXT: ret void
//
@@ -150,17 +154,18 @@ void d1() {
} while (1);
}
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-NOT: mustprogress
// CHECK-LABEL: @d2(
// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
+// CHECK-NEXT: br label %do.body
// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
+// CHECK-NEXT: br label %do.cond
// CHECK: do.cond:
// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY]], label [[DO_END:%.*]], [[LOOP7:!llvm.loop !.*]]
+// C99-NOT: br {{.*}}, !llvm.loop
+// C11: br i1 [[CMP]], label %do.body, label %do.end, !llvm.loop [[LOOP4:!.*]]
// CHECK: do.end:
// CHECK-NEXT: ret void
//
@@ -169,23 +174,24 @@ void d2() {
} while (a == b);
}
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-NOT: mustprogress
// CHECK-LABEL: @D(
// CHECK-NEXT: entry:
-// CHECK-NEXT: br label [[DO_BODY:%.*]]
+// CHECK-NEXT: br label %do.body
// CHECK: do.body:
-// CHECK-NEXT: br label [[DO_COND:%.*]]
+// CHECK-NEXT: br label %do.cond
// CHECK: do.cond:
-// CHECK-NEXT: br i1 true, label [[DO_BODY]], label [[DO_END:%.*]]
+// CHECK-NOT: br label {{.*}}, !llvm.loop
// CHECK: do.end:
-// CHECK-NEXT: br label [[DO_BODY1:%.*]]
+// CHECK-NEXT: br label %do.body1
// CHECK: do.body1:
-// CHECK-NEXT: br label [[DO_COND2:%.*]]
+// CHECK-NEXT: br label %do.cond2
// CHECK: do.cond2:
// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
-// CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY1]], label [[DO_END3:%.*]], [[LOOP8:!llvm.loop !.*]]
+// C99-NOT: br {{.*}}, !llvm.loop
+// C11: br i1 [[CMP]], label %do.body1, label %do.end3, !llvm.loop [[LOOP5:!.*]]
// CHECK: do.end3:
// CHECK-NEXT: ret void
//
@@ -195,3 +201,10 @@ void D() {
do {
} while (a == b);
}
+
+// C11: [[LOOP1]] = distinct !{[[LOOP1]], [[MP:!.*]]}
+// C11: [[MP]] = !{!"llvm.loop.mustprogress"}
+// C11: [[LOOP2]] = distinct !{[[LOOP2]], [[MP]]}
+// C11: [[LOOP3]] = distinct !{[[LOOP3]], [[MP]]}
+// C11: [[LOOP4]] = distinct !{[[LOOP4]], [[MP]]}
+// C11: [[LOOP5]] = distinct !{[[LOOP5]], [[MP]]}
diff --git a/clang/test/CodeGenCXX/attr-mustprogress.cpp b/clang/test/CodeGenCXX/attr-mustprogress.cpp
new file mode 100644
index 000000000000..df643ac90f39
--- /dev/null
+++ b/clang/test/CodeGenCXX/attr-mustprogress.cpp
@@ -0,0 +1,313 @@
+// RUN: %clang_cc1 -std=c++98 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX98 %s
+// RUN: %clang_cc1 -std=c++11 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s
+// RUN: %clang_cc1 -std=c++14 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s
+// RUN: %clang_cc1 -std=c++17 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s
+// RUN: %clang_cc1 -std=c++20 -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX11 %s
+
+int a = 0;
+int b = 0;
+
+// CHECK: datalayout
+
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// CHECK-LABEL: @_Z2f0v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %for.cond
+// CHECK: for.cond:
+// CXX98-NOT: br {{.*}} llvm.loop
+// CXX11-NOT: br {{.*}} llvm.loop
+void f0() {
+ for (; ;) ;
+}
+
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// CHECK-LABEL: @_Z2f1v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %for.cond
+// CHECK: for.cond:
+// CHECK-NEXT: br i1 true, label %for.body, label %for.end
+// CHECK: for.body:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NOT: br {{.*}}, !llvm.loop
+// CHECK: for.end:
+// CHECK-NEXT: ret void
+//
+void f1() {
+ for (; 1;)
+ ;
+}
+
+// CXX98-NOT: mustprogress
+// CXX11: mustprogress
+// CHECK-LABEL: @_Z2f2v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %for.cond
+// CHECK: for.cond:
+// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
+// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
+// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
+// CHECK-NEXT: br i1 [[CMP]], label %for.body, label %for.end
+// CHECK: for.body:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11: br label %for.cond, !llvm.loop [[LOOP1:!.*]]
+// CHECK: for.end:
+// CHECK-NEXT: ret void
+//
+void f2() {
+ for (; a == b;)
+ ;
+}
+
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// CHECK-LABEL: @_Z1Fv(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %for.cond
+// CHECK: for.cond:
+// CHECK-NEXT: br i1 true, label %for.body, label %for.end
+// CHECK: for.body:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NOT: br {{.*}}, !llvm.loop
+// CHECK: for.end:
+// CHECK-NEXT: br label %for.cond1
+// CHECK: for.cond1:
+// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
+// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
+// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
+// CHECK-NEXT: br i1 [[CMP]], label %for.body2, label %for.end3
+// CHECK: for.body2:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11: br label %for.cond1, !llvm.loop [[LOOP2:!.*]]
+// CHECK: for.end3:
+// CHECK-NEXT: ret void
+//
+void F() {
+ for (; 1;)
+ ;
+ for (; a == b;)
+ ;
+}
+
+// CXX98-NOT: mustprogress
+// CXX11_NOT: mustprogress
+// CHECK-LABEL: @_Z2F2v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %for.cond
+// CHECK: for.cond:
+// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
+// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
+// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
+// CHECK-NEXT: br i1 [[CMP]], label %for.body, label %for.end
+// CHECK: for.body:
+// CXX98_NOT: br {{.*}} !llvm.loop
+// CXX11-NEXT: br label %for.cond, !llvm.loop
+// CHECK: for.end:
+// CHECK-NEXT: br label %for.cond1
+// CHECK: for.cond1:
+// CHECK-NEXT: br i1 true, label %for.body2, label %for.end3
+// CHECK: for.body2:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NOT: br {{.*}}, !llvm.loop
+// CHECK: for.end3:
+// CHECK-NEXT: ret void
+//
+void F2() {
+ for (; a == b;)
+ ;
+ for (; 1;)
+ ;
+}
+
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// CHECK-LABEL: @_Z2w1v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %while.body
+// CHECK: while.body:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NOT: br {{.*}}, !llvm.loop
+//
+void w1() {
+ while (1)
+ ;
+}
+
+// CXX98-NOT: mustprogress
+// CXX11: mustprogress
+// CHECK-LABEL: @_Z2w2v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %while.cond
+// CHECK: while.cond:
+// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
+// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
+// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
+// CHECK-NEXT: br i1 [[CMP]], label %while.body, label %while.end
+// CHECK: while.body:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NEXT: br label %while.cond, !llvm.loop [[LOOP3:!.*]]
+// CHECK: while.end:
+// CHECK-NEXT: ret void
+//
+void w2() {
+ while (a == b)
+ ;
+}
+
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// CHECK-LABEL: @_Z1Wv(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %while.cond
+// CHECK: while.cond:
+// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
+// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
+// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
+// CHECK-NEXT: br i1 [[CMP]], label %while.body, label %while.end
+// CHECK: while.body:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NEXT: br label %while.cond, !llvm.loop [[LOOP4:!.*]]
+// CHECK: while.end:
+// CHECK-NEXT: br label %while.body2
+// CHECK: while.body2:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NOT: br {{.*}}, !llvm.loop
+//
+void W() {
+ while (a == b)
+ ;
+ while (1)
+ ;
+}
+
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// CHECK-LABEL: @_Z2W2v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %while.body
+// CHECK: while.body:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NOT: br {{.*}}, !llvm.loop
+//
+void W2() {
+ while (1)
+ ;
+ while (a == b)
+ ;
+}
+
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// CHECK-LABEL: @_Z2d1v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %do.body
+// CHECK: do.body:
+// CHECK-NEXT: br label %do.cond
+// CHECK: do.cond:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NOT: br {{.*}}, !llvm.loop
+// CHECK: do.end:
+// CHECK-NEXT: ret void
+//
+void d1() {
+ do
+ ;
+ while (1);
+}
+
+// CXX98-NOT: mustprogress
+// CXX11: mustprogress
+// CHECK-LABEL: @_Z2d2v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %do.body
+// CHECK: do.body:
+// CHECK-NEXT: br label %do.cond
+// CHECK: do.cond:
+// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
+// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
+// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NEXT: br i1 [[CMP]], label %do.body, label %do.end, !llvm.loop [[LOOP5:!.*]]
+// CHECK: do.end:
+// CHECK-NEXT: ret void
+//
+void d2() {
+ do
+ ;
+ while (a == b);
+}
+
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// CHECK-LABEL: @_Z1Dv(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %do.body
+// CHECK: do.body:
+// CHECK-NEXT: br label %do.cond
+// CHECK: do.cond:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NOT: br {{.*}}, !llvm.loop
+// CHECK: do.end:
+// CHECK-NEXT: br label %do.body1
+// CHECK: do.body1:
+// CHECK-NEXT: br label %do.cond2
+// CHECK: do.cond2:
+// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
+// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
+// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NEXT: br i1 [[CMP]], label %do.body1, label %do.end3, !llvm.loop [[LOOP6:!.*]]
+// CHECK: do.end3:
+// CHECK-NEXT: ret void
+//
+void D() {
+ do
+ ;
+ while (1);
+ do
+ ;
+ while (a == b);
+}
+
+// CXX98-NOT: mustprogress
+// CXX11-NOT: mustprogress
+// CHECK-LABEL: @_Z2D2v(
+// CHECK-NEXT: entry:
+// CHECK-NEXT: br label %do.body
+// CHECK: do.body:
+// CHECK-NEXT: br label %do.cond
+// CHECK: do.cond:
+// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
+// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
+// CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP0]], [[TMP1]]
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NEXT: br i1 [[CMP]], label %do.body, label %do.end, !llvm.loop [[LOOP7:!.*]]
+// CHECK: do.end:
+// CHECK-NEXT: br label %do.body1
+// CHECK: do.body1:
+// CHECK-NEXT: br label %do.cond2
+// CHECK: do.cond2:
+// CXX98-NOT: br {{.*}}, !llvm.loop
+// CXX11-NOT: br {{.*}}, !llvm.loop
+// CHECK: do.end3:
+// CHECK-NEXT: ret void
+//
+void D2() {
+ do
+ ;
+ while (a == b);
+ do
+ ;
+ while (1);
+}
+
+
+// CXX11: [[LOOP1]] = distinct !{[[LOOP1]], [[MP:!.*]]}
+// CXX11: [[MP]] = !{!"llvm.loop.mustprogress"}
+// CXX11: [[LOOP2]] = distinct !{[[LOOP2]], [[MP]]}
+// CXX11: [[LOOP3]] = distinct !{[[LOOP3]], [[MP]]}
+// CXX11: [[LOOP4]] = distinct !{[[LOOP4]], [[MP]]}
+// CXX11: [[LOOP5]] = distinct !{[[LOOP5]], [[MP]]}
+// CXX11: [[LOOP6]] = distinct !{[[LOOP6]], [[MP]]}
+// CXX11: [[LOOP7]] = distinct !{[[LOOP7]], [[MP]]}
More information about the cfe-commits
mailing list