add CondValue to unify refinements and code emission (#26145)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26145
This is step towards isinstance type refinement.
It primarily does yak shaving in compiler.cpp to unify the handling
of special case behavior that occurs in conditional expressions:
* Handling type refinement as part of emission.
* Handling `is None` static-if specialization.
It introduces a CondValue object that is a Value that also has
additional type refinements that are true when that Value is true,
and potentialy a static-true/false value that, if set, will cause if
statements to be handled statically, omitting typechecking of the other side.
This ends up expanding some behavior, for instance `is None` specialization
used to happen only for single expressions, but now works through
boolean logic.
Test Plan: Imported from OSS
Differential Revision: D17359500
Pulled By: zdevito
fbshipit-source-id: ce93804496c8b4c3197a5966bc28c608465fda64