[llvm] [SLP] NFC. Replace MainOp and AltOp in TreeEntry with InstructionsState. (PR #120198)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 8 13:24:02 PST 2025
================
@@ -3402,30 +3403,27 @@ class BoUpSLP {
auto *I = dyn_cast<Instruction>(Op);
if (I && isOpcodeOrAlt(I))
return Op;
- return MainOp;
+ return S.getMainOp();
}
void setOperations(const InstructionsState &S) {
assert(S && "InstructionsState is invalid.");
- MainOp = S.getMainOp();
- AltOp = S.getAltOp();
+ this->S = S;
}
- Instruction *getMainOp() const {
- return MainOp;
- }
+ Instruction *getMainOp() const { return S.getMainOp(); }
- Instruction *getAltOp() const {
- return AltOp;
- }
+ Instruction *getAltOp() const { return S.getAltOp(); }
/// The main/alternate opcodes for the list of instructions.
- unsigned getOpcode() const {
- return MainOp ? MainOp->getOpcode() : 0;
- }
+ unsigned getOpcode() const { return S.getOpcode(); }
- unsigned getAltOpcode() const {
- return AltOp ? AltOp->getOpcode() : 0;
+ unsigned getAltOpcode() const { return S.getAltOpcode(); }
+
+ bool isInstructionsStateValid() const {
+ assert((S.valid() || isGather()) &&
+ "Invalid InstructionsState must be gathered.");
----------------
alexey-bataev wrote:
No need for assertion here
https://github.com/llvm/llvm-project/pull/120198
More information about the llvm-commits
mailing list