From c7ba9555cf1f4eb49e03428f60f1dd2cdb5b78c4 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sat, 23 Mar 2019 13:44:06 +0000 Subject: [PATCH] [SLPVectorizer] reorderInputsAccordingToOpcode - use InstructionState directly. NFCI. llvm-svn: 356832 --- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 8865dc4..4ee7a2f 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -683,7 +683,8 @@ private: /// \reorder commutative operands to get better probability of /// generating vectorized code. - void reorderInputsAccordingToOpcode(unsigned Opcode, ArrayRef VL, + void reorderInputsAccordingToOpcode(const InstructionsState &S, + ArrayRef VL, SmallVectorImpl &Left, SmallVectorImpl &Right); struct TreeEntry { @@ -1896,7 +1897,7 @@ void BoUpSLP::buildTree_rec(ArrayRef VL, unsigned Depth, // have the same opcode. if (isa(VL0) && VL0->isCommutative()) { ValueList Left, Right; - reorderInputsAccordingToOpcode(S.getOpcode(), VL, Left, Right); + reorderInputsAccordingToOpcode(S, VL, Left, Right); UserTreeIdx.EdgeIdx = 0; buildTree_rec(Left, Depth + 1, UserTreeIdx); UserTreeIdx.EdgeIdx = 1; @@ -2910,10 +2911,12 @@ static bool shouldReorderOperands( return false; } -void BoUpSLP::reorderInputsAccordingToOpcode(unsigned Opcode, +void BoUpSLP::reorderInputsAccordingToOpcode(const InstructionsState &S, ArrayRef VL, SmallVectorImpl &Left, SmallVectorImpl &Right) { + unsigned Opcode = S.getOpcode(); + if (!VL.empty()) { // Peel the first iteration out of the loop since there's nothing // interesting to do anyway and it simplifies the checks in the loop. -- 2.7.4