[SLPVectorizer] getSameOpcode - remove useless cast [NFC]
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 13 Jun 2018 10:49:24 +0000 (10:49 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 13 Jun 2018 10:49:24 +0000 (10:49 +0000)
There's no need to cast the base Value to an Instruction

llvm-svn: 334588

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

index c80f463d1f6a1e63201d189b69d64173fc814e34..04b6a76c9d400e709360615baafb828a5ff35223 100644 (file)
@@ -423,7 +423,6 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL) {
   unsigned Opcode = Res.Opcode;
   if (!Res.HasAltOpcodes)
     return InstructionsState(VL[0], Opcode, false);
-  auto *OpInst = cast<Instruction>(VL[0]);
   unsigned AltOpcode = getAltOpcode(Opcode);
   // Examine each element in the list instructions VL to determine
   // if some operations there could be considered as an alternative
@@ -432,9 +431,9 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL) {
     auto *I = cast<Instruction>(VL[Cnt]);
     unsigned InstOpcode = I->getOpcode();
     if (InstOpcode != (isOdd(Cnt) ? AltOpcode : Opcode))
-      return InstructionsState(OpInst, 0, false);
+      return InstructionsState(VL[0], 0, false);
   }
-  return InstructionsState(OpInst, Opcode, Res.HasAltOpcodes);
+  return InstructionsState(VL[0], Opcode, Res.HasAltOpcodes);
 }
 
 /// \returns true if all of the values in \p VL have the same type or false