usx95 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.

> Trying to explicitly compute whether there's a branch out seems both 
> difficult, and potentially costly for compile-time.

Computing this 100% accurately is indeed difficult. But if we allow 
false-positives, as in the current approach, it gets clearer and simpler. As 
far as compile-time is concerned, this involves revisiting the complete 
expression exactly one more time. We could, in principle, cache this per 
expression to keep this linear. 


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

Reply via email to