[PATCH] D91075: [clang] Fix ForStmt mustprogress handling

2020-11-09 Thread Atmn Patel via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfd3cad7a6016: [clang] Fix ForStmt mustprogress handling 
(authored by atmnpatel).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91075/new/

https://reviews.llvm.org/D91075

Files:
  clang/lib/CodeGen/CGStmt.cpp
  clang/test/CodeGen/attr-mustprogress-1.c
  clang/test/CodeGen/attr-mustprogress-1.cpp


Index: clang/test/CodeGen/attr-mustprogress-1.cpp
===
--- clang/test/CodeGen/attr-mustprogress-1.cpp
+++ clang/test/CodeGen/attr-mustprogress-1.cpp
@@ -7,6 +7,16 @@
 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:
Index: clang/test/CodeGen/attr-mustprogress-1.c
===
--- clang/test/CodeGen/attr-mustprogress-1.c
+++ clang/test/CodeGen/attr-mustprogress-1.c
@@ -7,6 +7,17 @@
 int a = 0;
 int b = 0;
 
+// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-LABEL: @f0(
+// 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: @f1(
 // CHECK-NEXT:  entry:
Index: clang/lib/CodeGen/CGStmt.cpp
===
--- clang/lib/CodeGen/CGStmt.cpp
+++ clang/lib/CodeGen/CGStmt.cpp
@@ -947,7 +947,6 @@
   Expr::EvalResult Result;
   if (LanguageRequiresProgress()) {
 if (!S.getCond()) {
-  LoopMustProgress = true;
   FnIsMustProgress = false;
 } else if (!S.getCond()->EvaluateAsInt(Result, getContext())) {
   LoopMustProgress = true;


Index: clang/test/CodeGen/attr-mustprogress-1.cpp
===
--- clang/test/CodeGen/attr-mustprogress-1.cpp
+++ clang/test/CodeGen/attr-mustprogress-1.cpp
@@ -7,6 +7,16 @@
 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:
Index: clang/test/CodeGen/attr-mustprogress-1.c
===
--- clang/test/CodeGen/attr-mustprogress-1.c
+++ clang/test/CodeGen/attr-mustprogress-1.c
@@ -7,6 +7,17 @@
 int a = 0;
 int b = 0;
 
+// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-LABEL: @f0(
+// 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: @f1(
 // CHECK-NEXT:  entry:
Index: clang/lib/CodeGen/CGStmt.cpp
===
--- clang/lib/CodeGen/CGStmt.cpp
+++ clang/lib/CodeGen/CGStmt.cpp
@@ -947,7 +947,6 @@
   Expr::EvalResult Result;
   if (LanguageRequiresProgress()) {
 if (!S.getCond()) {
-  LoopMustProgress = true;
   FnIsMustProgress = false;
 } else if (!S.getCond()->EvaluateAsInt(Result, getContext())) {
   LoopMustProgress = true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91075: [clang] Fix ForStmt mustprogress handling

2020-11-09 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91075/new/

https://reviews.llvm.org/D91075

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91075: [clang] Fix ForStmt mustprogress handling

2020-11-09 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel created this revision.
atmnpatel added reviewers: jdoerfert, aqjune, aaron.ballman.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
atmnpatel requested review of this revision.

D86841  had an error where for statements with 
no conditional were
required to make progress. This is not true, this patch removes that
line, and adds regression tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91075

Files:
  clang/lib/CodeGen/CGStmt.cpp
  clang/test/CodeGen/attr-mustprogress-1.c
  clang/test/CodeGen/attr-mustprogress-1.cpp


Index: clang/test/CodeGen/attr-mustprogress-1.cpp
===
--- clang/test/CodeGen/attr-mustprogress-1.cpp
+++ clang/test/CodeGen/attr-mustprogress-1.cpp
@@ -7,6 +7,16 @@
 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:
Index: clang/test/CodeGen/attr-mustprogress-1.c
===
--- clang/test/CodeGen/attr-mustprogress-1.c
+++ clang/test/CodeGen/attr-mustprogress-1.c
@@ -7,6 +7,17 @@
 int a = 0;
 int b = 0;
 
+// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-LABEL: @f0(
+// 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: @f1(
 // CHECK-NEXT:  entry:
Index: clang/lib/CodeGen/CGStmt.cpp
===
--- clang/lib/CodeGen/CGStmt.cpp
+++ clang/lib/CodeGen/CGStmt.cpp
@@ -947,7 +947,6 @@
   Expr::EvalResult Result;
   if (LanguageRequiresProgress()) {
 if (!S.getCond()) {
-  LoopMustProgress = true;
   FnIsMustProgress = false;
 } else if (!S.getCond()->EvaluateAsInt(Result, getContext())) {
   LoopMustProgress = true;


Index: clang/test/CodeGen/attr-mustprogress-1.cpp
===
--- clang/test/CodeGen/attr-mustprogress-1.cpp
+++ clang/test/CodeGen/attr-mustprogress-1.cpp
@@ -7,6 +7,16 @@
 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:
Index: clang/test/CodeGen/attr-mustprogress-1.c
===
--- clang/test/CodeGen/attr-mustprogress-1.c
+++ clang/test/CodeGen/attr-mustprogress-1.c
@@ -7,6 +7,17 @@
 int a = 0;
 int b = 0;
 
+// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK-LABEL: @f0(
+// 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: @f1(
 // CHECK-NEXT:  entry:
Index: clang/lib/CodeGen/CGStmt.cpp
===
--- clang/lib/CodeGen/CGStmt.cpp
+++ clang/lib/CodeGen/CGStmt.cpp
@@ -947,7 +947,6 @@
   Expr::EvalResult Result;
   if (LanguageRequiresProgress()) {
 if (!S.getCond()) {
-  LoopMustProgress = true;
   FnIsMustProgress = false;
 } else if (!S.getCond()->EvaluateAsInt(Result, getContext())) {
   LoopMustProgress = true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits