[TIR] Improve Let/LetStmt support. #5949
Merged
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.
Let/LetStmt are useful primitives to create variable bindings.
While let binding are harmful for simplification and integer analysis(due to the indirection), they are useful for other cases:
This PR improves the let support in the following ways:
while ignore more complicated cases(to avoid deep nest explosion)
We also relaxed the SSA checking conditions for Let expression, to allow the same var to be binded multiple times, as long as their binding value are equal to each other.
The overall recommendation is to only use Let in the cases when necessary(C0, C1).