efriedma-quic wrote: > > Instead of Expr::mayBranchOut, I'd prefer to just unconditionally create > > the alloca, then delete it later if it turns out we didn't actually need to > > emit the branch. > > I had earlier tried tracking instructions auxiliary to a particular cleanup > in #83224 > ([src](https://github.com/llvm/llvm-project/pull/83224/files#diff-9cdaea6a793ed2892bfcd6b431e933a49ebb25caa2bd1d630cd1ca823281092aR263-R286)). > This gets ugly very quickly and adds quite some complexity to the cleanup > addition and emission code. For example, more instructions could be added if > the cleanup is conditional.
You could simplify that code significantly, I think: instead of adding every instruction to the list, just add the alloca, then recursively delete all instructions that use the alloca. > As far as compile-time is concerned, this involves revisiting the complete > expression exactly one more time. You can end up visiting more than once if an array init contains another array init. https://github.com/llvm/llvm-project/pull/85398 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits