[llvm] r334588 - [SLPVectorizer] getSameOpcode - remove useless cast [NFC]

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 13 03:49:24 PDT 2018


Author: rksimon
Date: Wed Jun 13 03:49:24 2018
New Revision: 334588

URL: http://llvm.org/viewvc/llvm-project?rev=334588&view=rev
Log:
[SLPVectorizer] getSameOpcode - remove useless cast [NFC]

There's no need to cast the base Value to an Instruction

Modified:
    llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp

Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=334588&r1=334587&r2=334588&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Wed Jun 13 03:49:24 2018
@@ -423,7 +423,6 @@ static InstructionsState getSameOpcode(A
   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(A
     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




More information about the llvm-commits mailing list