[JIT] Metacompile boolean constants (#46721)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/46703
Previously, we would compile one side of an if-statement if it was a type-based expression we could statically resolve. I think it's reasonable to extend this metacompilation to booleans that are constant at compile time. There have been some instances where i've recommended unintuitive workarounds due to not having this behavior.
This is also possibly needed if we add boolean literals to schema declarations, which is a feature that might be needed to cleanup our `boolean_dispatch` mechanism.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/46721
Reviewed By: ppwwyyxx
Differential Revision: D25008862
Pulled By: eellison
fbshipit-source-id: 5bc60a18f1021c010cb6abbeb5399c669fe04312