git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336069
91177308-0d34-0410-b5e6-
96231b3b80d8
/// Some of the instructions in the list have alternate opcodes.
bool isAltShuffle() const { return Opcode != AltOpcode; }
/// Some of the instructions in the list have alternate opcodes.
bool isAltShuffle() const { return Opcode != AltOpcode; }
- bool isOpcodeOrAlt(unsigned CheckedOpcode) const {
+ bool isOpcodeOrAlt(Instruction *I) const {
+ unsigned CheckedOpcode = I->getOpcode();
return Opcode == CheckedOpcode || AltOpcode == CheckedOpcode;
}
return Opcode == CheckedOpcode || AltOpcode == CheckedOpcode;
}
/// OpValue.
static Value *isOneOf(const InstructionsState &S, Value *Op) {
auto *I = dyn_cast<Instruction>(Op);
/// OpValue.
static Value *isOneOf(const InstructionsState &S, Value *Op) {
auto *I = dyn_cast<Instruction>(Op);
- if (I && S.isOpcodeOrAlt(I->getOpcode()))
+ if (I && S.isOpcodeOrAlt(I))
return Op;
return S.OpValue;
}
return Op;
return S.OpValue;
}
// Push left and right operands of binary operation into Left and Right
for (Value *V : VL) {
auto *I = cast<Instruction>(V);
// Push left and right operands of binary operation into Left and Right
for (Value *V : VL) {
auto *I = cast<Instruction>(V);
- assert(S.isOpcodeOrAlt(I->getOpcode()) &&
- "Incorrect instruction in vector");
+ assert(S.isOpcodeOrAlt(I) && "Incorrect instruction in vector");
Left.push_back(I->getOperand(0));
Right.push_back(I->getOperand(1));
}
Left.push_back(I->getOperand(0));
Right.push_back(I->getOperand(1));
}
auto *Front = cast<Instruction>(S.OpValue);
auto *BB = Front->getParent();
assert(llvm::all_of(make_range(VL.begin(), VL.end()), [=](Value *V) -> bool {
auto *Front = cast<Instruction>(S.OpValue);
auto *BB = Front->getParent();
assert(llvm::all_of(make_range(VL.begin(), VL.end()), [=](Value *V) -> bool {
- return !S.isOpcodeOrAlt(cast<Instruction>(V)->getOpcode()) ||
- cast<Instruction>(V)->getParent() == BB;
+ auto *I = cast<Instruction>(V);
+ return !S.isOpcodeOrAlt(I) || I->getParent() == BB;
}));
// The last instruction in the bundle in program order.
}));
// The last instruction in the bundle in program order.
if (!LastInst) {
SmallPtrSet<Value *, 16> Bundle(VL.begin(), VL.end());
for (auto &I : make_range(BasicBlock::iterator(Front), BB->end())) {
if (!LastInst) {
SmallPtrSet<Value *, 16> Bundle(VL.begin(), VL.end());
for (auto &I : make_range(BasicBlock::iterator(Front), BB->end())) {
- if (Bundle.erase(&I) && S.isOpcodeOrAlt(I.getOpcode()))
+ if (Bundle.erase(&I) && S.isOpcodeOrAlt(&I))
LastInst = &I;
if (Bundle.empty())
break;
LastInst = &I;
if (Bundle.empty())
break;
SmallVector<Constant *, 8> Mask(e);
for (unsigned i = 0; i < e; ++i) {
auto *OpInst = cast<Instruction>(E->Scalars[i]);
SmallVector<Constant *, 8> Mask(e);
for (unsigned i = 0; i < e; ++i) {
auto *OpInst = cast<Instruction>(E->Scalars[i]);
- unsigned InstOpcode = OpInst->getOpcode();
- assert(S.isOpcodeOrAlt(InstOpcode) &&
- "Unexpected main/alternate opcode");
- if (InstOpcode == S.AltOpcode) {
+ assert(S.isOpcodeOrAlt(OpInst) && "Unexpected main/alternate opcode");
+ if (OpInst->getOpcode() == S.AltOpcode) {
Mask[i] = Builder.getInt32(e + i);
AltScalars.push_back(E->Scalars[i]);
} else {
Mask[i] = Builder.getInt32(e + i);
AltScalars.push_back(E->Scalars[i]);
} else {