d: Don't generate a PREDICT_EXPR when assert contracts are turned off.
authorIain Buclaw <ibuclaw@gdcproject.org>
Mon, 26 Jul 2021 17:47:25 +0000 (19:47 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Fri, 30 Jul 2021 10:51:36 +0000 (12:51 +0200)
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

index 76c1e61..73e0abe 100644 (file)
@@ -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.  */