https://github.com/MaheshRavishankar requested changes to this pull request. I am not sure this is a canonicalization. This seems like a cost-model based thing. Someone else might want to hoist the if condition https://github.com/llvm/llvm-project/pull/165216