================

----------------
NagyDonat wrote:

This function also adds the expression `Cond` itself as a live expression –– 
which is correct in the ternary operator case (there this argument is one of 
the children of the ternary operator), but is incorrect in the case of the 
logical operators (where you want to mark the children as live, but don't want 
to mark the operator itself as live).

This counteracts the logic at the beginning of `TransforFunctions::Visit` which 
removes `S` (the statement, in this case the logical operator) from the live 
set. As the liveness information is spread by a backwards sweep, if I 
understand correctly, this could lead to a situation where the logical binary 
operator never becomes non-live during the backwards sweep, i.e. it is live 
from the beginning of the analyzed code to the point where its parent 
expression is evaluated. (Although there may be some other logic that 
counteracts this.)

To fix this issue, I would suggest calling `AddAllConditionalTerms` separately 
on the LHS and the LHS of the logical binary operator found in 
`TransforFunctions::Visit` -- instead of passing the whole operator to a single 
call.

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

Reply via email to