[InstCombine] allow more shuffle folds using safe constants
authorSanjay Patel <spatel@rotateright.com>
Mon, 9 Jul 2018 23:22:47 +0000 (23:22 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 9 Jul 2018 23:22:47 +0000 (23:22 +0000)
commit69faf464eded4d858cd2630ab2dd9ff97ae63604
treeebd849ad998e998b1a173e8f6d5d5152cfc44074
parenta5bb6d53f2f4016a335e8dee310e76493ef3b825
[InstCombine] allow more shuffle folds using safe constants

getSafeVectorConstantForBinop() was calling getBinOpIdentity() assuming
that the constant we wanted was operand 1 (RHS). That's wrong, but I
don't think we could expose a bug or even a suboptimal fold from that
because the callers have other guards for any binop that would have
been affected.

llvm-svn: 336617
llvm/lib/Transforms/InstCombine/InstCombineInternal.h
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/shuffle_select.ll