diff mbox series

[committed,10/12] d: Don't generate a PREDICT_EXPR when assert contracts are turned off.

Message ID 20210730110111.569140-10-ibuclaw@gdcproject.org
State New
Headers show
Series d: Series of refactorings to the D front-end | expand

Commit Message

Iain Buclaw July 30, 2021, 11:01 a.m. UTC
This expression is just discarded by add_stmt, so never reaches the
middle-end.

gcc/d/ChangeLog:

	* expr.cc (ExprVisitor::visit (AssertExp *)): Don't generate
	PREDICT_EXPR.
---
 gcc/d/expr.cc | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc
index 76c1e613e77..73e0abeaa43 100644
--- a/gcc/d/expr.cc
+++ b/gcc/d/expr.cc
@@ -2085,15 +2085,9 @@  public:
       }
     else
       {
-	/* Assert contracts are turned off, if the contract condition has no
-	   side effects can still use it as a predicate for the optimizer.  */
-	if (TREE_SIDE_EFFECTS (arg))
-	  {
-	    this->result_ = void_node;
-	    return;
-	  }
-
-	assert_fail = build_predict_expr (PRED_NORETURN, NOT_TAKEN);
+	/* Assert contracts are turned off.  */
+	this->result_ = void_node;
+	return;
       }
 
     /* Build condition that we are asserting in this contract.  */