[Cherry-pick][Dy2stat]remove no_value using var.name for ifelse (#36513) #36565
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
Bug fixes
PR changes
Others
Describe
使用下面代码对返回结果进行讨论,if分支中有两个变量y, z,else分支中有两个变量c, z。
对于两个分支的ifelse,可以分为两种情况,一:两个分支有共有变量,二:两个分支无共有变量。下面的讨论中,else分支返回结果是指的动转静后静态图代码return语句的返回结果。
1 两个分支有共有变量,即else分支中有z变量
else分支没有return语句, else分支返回结果return z
else分支中return None,else分支返回结果((no_val_0, no_val_1), z)
else分支有return语句 return c,else分支返回结果((c, no_val_0), z)
else分支有return语句 return z, else分支返回结果((z, no_val_0), z)
else分支有return语句 return c, z,else分支返回结果((c, z), z)
2 两个分支无共有变量,即else分支无z变量
else分支没有return语句,else分支最后只有return,没有返回变量
else分支return None,else分支返回结果(no_val_0, no_val_1)
else分支return c,else分支返回结果(c, no_val_0)
else分支return c, d,else分支返回结果(c, d)
上面的情况需要考虑,删除用于填充的no_val