================ @@ -816,22 +816,18 @@ bool ByteCodeExprGen<Emitter>::VisitArrayInitLoopExpr( const ArrayInitLoopExpr *E) { assert(Initializing); assert(!DiscardResult); + + // We visit the common opaque expression here once so we have its value + // cached. + if (!this->discard(E->getCommonExpr())) + return false; + // TODO: This compiles to quite a lot of bytecode if the array is larger. // Investigate compiling this to a loop. - const Expr *SubExpr = E->getSubExpr(); - const Expr *CommonExpr = E->getCommonExpr(); size_t Size = E->getArraySize().getZExtValue(); std::optional<PrimType> ElemT = classify(SubExpr->getType()); - // If the common expression is an opaque expression, we visit it - // here once so we have its value cached. - // FIXME: This might be necessary (or useful) for all expressions. - if (isa<OpaqueValueExpr>(CommonExpr)) { ---------------- tbaederr wrote:
We should assert this then. https://github.com/llvm/llvm-project/pull/70053 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits