================ @@ -15097,14 +15125,75 @@ bool SemaOpenMP::checkTransformableLoopNest( llvm_unreachable("Unhandled loop transformation"); if (!DependentPreInits) return; - llvm::append_range(OriginalInits.back(), - cast<DeclStmt>(DependentPreInits)->getDeclGroup()); + // CompoundStmts are used as lists of other statements, add their + // contents, not the lists themselves to avoid nesting. This is + // necessary because DeclStmts need to be visible after the pre-init. + else if (auto *CS = dyn_cast<CompoundStmt>(DependentPreInits)) + llvm::append_range(OriginalInits.back(), CS->body()); + else + OriginalInits.back().push_back(DependentPreInits); ---------------- alexey-bataev wrote:
Suggest moving this pattern to a function to avoid copying it. https://github.com/llvm/llvm-project/pull/91459 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits