This code was migrated from InstCombine a few years ago. InstCombine had nearby code that would move Constants to the RHS for these, but InstSimplify doesn't have such code on this path.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
LGTM.
I acknowledge that there are concerns about division-of-labor between InstSimplify and InstCombine as well as the combination of those two with other passes (see current llvm-dev threads about compile-time), but handling commuted variants of existing patterns is always good (makes the pass behavior more consistent) and cheap (if it's not, then that's an independent problem).