Skip to content

Commit

Permalink
[AArch64][GlobalISel] Use MI::getIntrinsicID in more spots. NFC.
Browse files Browse the repository at this point in the history
There's technically a difference in the logic used by these
findIntrinsicID and MachineInstr::getIntrinsicID, but it shouldn't
be a meaningful difference here, with G_INTRINSIC instructions.
getIntrinsicID's "first non-def" logic should be correct for those.
  • Loading branch information
ahmedbougacha committed Sep 15, 2021
1 parent 94a2f9c commit e159d3c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
19 changes: 2 additions & 17 deletions llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5201,17 +5201,6 @@ bool AArch64InstructionSelector::selectBuildVector(MachineInstr &I,
return true;
}

/// Helper function to find an intrinsic ID on an a MachineInstr. Returns the
/// ID if it exists, and 0 otherwise.
static unsigned findIntrinsicID(MachineInstr &I) {
auto IntrinOp = find_if(I.operands(), [&](const MachineOperand &Op) {
return Op.isIntrinsicID();
});
if (IntrinOp == I.operands_end())
return 0;
return IntrinOp->getIntrinsicID();
}

bool AArch64InstructionSelector::selectVectorLoadIntrinsic(unsigned Opc,
unsigned NumVecs,
MachineInstr &I) {
Expand Down Expand Up @@ -5244,9 +5233,7 @@ bool AArch64InstructionSelector::selectVectorLoadIntrinsic(unsigned Opc,
bool AArch64InstructionSelector::selectIntrinsicWithSideEffects(
MachineInstr &I, MachineRegisterInfo &MRI) {
// Find the intrinsic ID.
unsigned IntrinID = findIntrinsicID(I);
if (!IntrinID)
return false;
unsigned IntrinID = I.getIntrinsicID();

const LLT S8 = LLT::scalar(8);
const LLT S16 = LLT::scalar(16);
Expand Down Expand Up @@ -5365,9 +5352,7 @@ bool AArch64InstructionSelector::selectIntrinsicWithSideEffects(

bool AArch64InstructionSelector::selectIntrinsic(MachineInstr &I,
MachineRegisterInfo &MRI) {
unsigned IntrinID = findIntrinsicID(I);
if (!IntrinID)
return false;
unsigned IntrinID = I.getIntrinsicID();

switch (IntrinID) {
default:
Expand Down
11 changes: 1 addition & 10 deletions llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,18 +933,9 @@ bool AArch64LegalizerInfo::legalizeSmallCMGlobalValue(
return true;
}

static unsigned findIntrinsicID(MachineInstr &I) {
auto IntrinOp = find_if(I.operands(), [&](const MachineOperand &Op) {
return Op.isIntrinsicID();
});
if (IntrinOp == I.operands_end())
return 0;
return IntrinOp->getIntrinsicID();
}

bool AArch64LegalizerInfo::legalizeIntrinsic(LegalizerHelper &Helper,
MachineInstr &MI) const {
switch (findIntrinsicID(MI)) {
switch (MI.getIntrinsicID()) {
case Intrinsic::vacopy: {
unsigned PtrSize = ST->isTargetILP32() ? 4 : 8;
unsigned VaListSize =
Expand Down

0 comments on commit e159d3c

Please sign in to comment.