[InstCombine] fix opcode check in shuffle fold
authorSanjay Patel <spatel@rotateright.com>
Thu, 28 Jun 2018 20:52:43 +0000 (20:52 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 28 Jun 2018 20:52:43 +0000 (20:52 +0000)
There's no way to expose this difference currently,
but we should use the updated variable because the
original opcodes can go stale if we transform into
something new.

llvm-svn: 335920

llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

index 458b0f0..d4fb086 100644 (file)
@@ -1199,7 +1199,7 @@ static Instruction *foldSelectShuffles(ShuffleVectorInst &Shuf) {
   // If the shuffle mask contains undef elements, then the new constant
   // vector will have undefs in those lanes. This could cause the entire
   // binop to be undef.
-  if (B0->isIntDivRem())
+  if (Instruction::isIntDivRem(BOpc))
     NewC = getSafeVectorConstantForIntDivRem(NewC);
 
   Instruction *NewBO = ConstantsAreOp1 ? BinaryOperator::Create(BOpc, X, NewC) :