[JIT] fix common_expression_hoisting (#74794)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74794
aliasdb check was incorrect, caused issues in #74056
This checks whether it is safe to move before the node at the beginning
of the if branch instead of after the node at the beginning of the if
branch
Test Plan: Imported from OSS
Reviewed By: Gamrix
Differential Revision: D35188927
Pulled By: davidberard98
fbshipit-source-id: 722ecf67840a066dbee55b4033c35122a20f368e
(cherry picked from commit 547eb3d665183002c7fed100835734c1713d2eee)