diff mbox series

[committed,09/12] d: Clarify comment for generating static array assignment with literal.

Message ID 20210730110111.569140-9-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
The code block is done as an optimization to elide a call to the runtime
library helpers _d_arrayctor or _d_arrayassign.

gcc/d/ChangeLog:

	* expr.cc (ExprVisitor::visit (AssignExp *)): Clarify comment
	  for generating static array assignment with literal.
---
 gcc/d/expr.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc
index 85269c6b2be..76c1e613e77 100644
--- a/gcc/d/expr.cc
+++ b/gcc/d/expr.cc
@@ -1163,9 +1163,9 @@  public:
 	bool destructor = needs_dtor (etype);
 	bool lvalue = lvalue_p (e->e2);
 
-	/* Even if the elements in rhs are all rvalues and don't have
-	   to call postblits, this assignment should call dtors on old
-	   assigned elements.  */
+	/* Optimize static array assignment with array literal.  Even if the
+	   elements in rhs are all rvalues and don't have to call postblits,
+	   this assignment should call dtors on old assigned elements.  */
 	if ((!postblit && !destructor)
 	    || (e->op == TOKconstruct && e->e2->op == TOKarrayliteral)
 	    || (e->op == TOKconstruct && !lvalue && postblit)