[llvm] [SLP] NFC. Replace TreeEntry::setOperandsInOrder with VLOperands. (PR #113880)

Han-Kuan Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 22 03:04:51 PST 2024


================
@@ -8591,46 +8572,13 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
 
       TreeEntry *TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx,
                                    ReuseShuffleIndices);
-      // Sort operands of the instructions so that each side is more likely to
-      // have the same opcode.
-      if (isCommutative(VL0)) {
-        ValueList Left, Right;
-        reorderInputsAccordingToOpcode(VL, Left, Right, *this);
-        TE->setOperand(0, Left);
-        TE->setOperand(1, Right);
-        SmallVector<ValueList> Operands;
-        for (unsigned I : seq<unsigned>(2, CI->arg_size())) {
-          Operands.emplace_back();
-          if (isVectorIntrinsicWithScalarOpAtArg(ID, I))
-            continue;
----------------
HanKuanChen wrote:

`for (unsigned I : seq<unsigned>(2, CI->arg_size())) {`
It starts at 2.

The only difference is the new code will store it.
The old code for other arguments which is `isVectorIntrinsicWithScalarOpAtArg`, `setOperand` will not store it.
The new code for other arguments which is `isVectorIntrinsicWithScalarOpAtArg`, `setOperand` will store it.

But both the old code and the new code will not execute buildTree_rec if the argument is `isVectorIntrinsicWithScalarOpAtArg`.

https://github.com/llvm/llvm-project/pull/113880


More information about the llvm-commits mailing list