[llvm] e159d3c - [AArch64][GlobalISel] Use MI::getIntrinsicID in more spots. NFC.
Ahmed Bougacha via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 15 16:45:48 PDT 2021
Author: Ahmed Bougacha
Date: 2021-09-15T16:45:34-07:00
New Revision: e159d3cbfc250115d1244f3a6219436a52f90f86
URL: https://github.com/llvm/llvm-project/commit/e159d3cbfc250115d1244f3a6219436a52f90f86
DIFF: https://github.com/llvm/llvm-project/commit/e159d3cbfc250115d1244f3a6219436a52f90f86.diff
LOG: [AArch64][GlobalISel] Use MI::getIntrinsicID in more spots. NFC.
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.
Added:
Modified:
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
index 6634a197df69b..effe3ea86f22d 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
@@ -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) {
@@ -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);
@@ -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:
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
index 8fabf29dc23d1..fbae7c5c7fc82 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
@@ -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 =
More information about the llvm-commits
mailing list