[llvm] [SLP] NFC. Replace TreeEntry::setOperandsInOrder with VLOperands. (PR #113880)
Han-Kuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 05:06:42 PST 2024
================
@@ -2337,10 +2340,11 @@ class BoUpSLP {
assert((empty() || VL.size() == getNumLanes()) &&
"Expected same number of lanes");
assert(isa<Instruction>(VL[0]) && "Expected instruction");
+ unsigned NumOperands = cast<Instruction>(VL[0])->getNumOperands();
+ // IntrinsicInst::isCommutative returns true if swapping the first "two"
+ // arguments to the intrinsic produces the same result.
constexpr unsigned IntrinsicNumOperands = 2;
- unsigned NumOperands = isa<IntrinsicInst>(VL[0])
- ? IntrinsicNumOperands
- : cast<Instruction>(VL[0])->getNumOperands();
+ Arg_size = isa<IntrinsicInst>(VL[0]) ? IntrinsicNumOperands : NumOperands;
----------------
HanKuanChen wrote:
We need `ArgSize` to make sure `reorder` only swap the first two operands. After this PR, `OpsVec` also contains non swappable operands (because we want `appendOperandsOfVL` can be reused even the operands of VL is not commutative).
https://github.com/llvm/llvm-project/pull/113880
More information about the llvm-commits
mailing list