public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2621] d: Don't generate a PREDICT_EXPR when assert contracts are turned off.
@ 2021-07-30 10:56 Iain Buclaw
  0 siblings, 0 replies; only message in thread
From: Iain Buclaw @ 2021-07-30 10:56 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:5ad4eab2e6ffc4c7f5a11f52239377eeae26310f

commit r12-2621-g5ad4eab2e6ffc4c7f5a11f52239377eeae26310f
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Mon Jul 26 19:47:25 2021 +0200

    d: Don't generate a PREDICT_EXPR when assert contracts are turned off.
    
    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.

Diff:
---
 gcc/d/expr.cc | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

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.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-30 10:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 10:56 [gcc r12-2621] d: Don't generate a PREDICT_EXPR when assert contracts are turned off Iain Buclaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).