AmrDeveloper wrote:

> > This is the current CIR generated when CleanupScope is used inside a ternary
> > I am thinking to create a temp alloca to store the result of the call and 
> > load it after cleanup to use it in the yield of the ternary.
> > What do you think? @andykaylor
> 
> Can you detect, in a general way, all values that are created in a cleanup 
> scope but referenced outside the scope? A temporary variable seems like a 
> reasonable solution, as long as the implementation is clean and flexible.

In this case, it's not hard to detect from the code that it will reference 
variables from outside because when we pop scope, we add a terminator if 
missing, then we move the insertion point after scope op, but in ternary with 
cleanup, the value that should be used in yield is inside the scope, the fix 
it's not hard and i think it's clean but i need to double check if there is any 
possiable edge case too

https://github.com/llvm/llvm-project/pull/180276
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to