manik-muk wrote: That's right! Just tested with some other architectures and found that they also miss the optimization. Would you like a more generic / generalizable solution? Can potentially modify DAGCombiner.cpp to make this generalize https://github.com/llvm/llvm-project/pull/161784