diff options
| author | Jessica Paquette <jpaquette@apple.com> | 2019-07-10 18:46:56 +0000 |
|---|---|---|
| committer | Jessica Paquette <jpaquette@apple.com> | 2019-07-10 18:46:56 +0000 |
| commit | 7c95925b133f0e2d2bcf2ec570c675866d47d298 (patch) | |
| tree | 260ec5ab66d0cd3ea10972809026cab9aeee0391 /llvm/lib/Target | |
| parent | 3132968ae969659a05f84705aa9e8f474fbea29d (diff) | |
| download | bcm5719-llvm-7c95925b133f0e2d2bcf2ec570c675866d47d298.tar.gz bcm5719-llvm-7c95925b133f0e2d2bcf2ec570c675866d47d298.zip | |
[GlobalISel][AArch64] Use getOpcodeDef instead of findMIFromReg
Some minor cleanup.
This function in Utils does the same thing as `findMIFromReg`. It also looks
through copies, which `findMIFromReg` didn't.
Delete `findMIFromReg` and use `getOpcodeDef` instead. This only happens in
`tryOptVectorDup` right now.
Update opt-shuffle-splat to show that we can look through the copies now, too.
Differential Revision: https://reviews.llvm.org/D64520
llvm-svn: 365684
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp index 9ff5827fc42..41b58504daf 100644 --- a/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp @@ -190,17 +190,6 @@ private: unsigned char OpFlags) const; // Optimization methods. - - // Helper function to check if a reg def is an MI with a given opcode and - // returns it if so. - MachineInstr *findMIFromReg(unsigned Reg, unsigned Opc, - MachineIRBuilder &MIB) const { - auto *Def = MIB.getMRI()->getVRegDef(Reg); - if (!Def || Def->getOpcode() != Opc) - return nullptr; - return Def; - } - bool tryOptVectorShuffle(MachineInstr &I) const; bool tryOptVectorDup(MachineInstr &MI) const; bool tryOptSelect(MachineInstr &MI) const; @@ -3325,12 +3314,12 @@ bool AArch64InstructionSelector::tryOptVectorDup(MachineInstr &I) const { // Begin matching the insert. auto *InsMI = - findMIFromReg(I.getOperand(1).getReg(), G_INSERT_VECTOR_ELT, MIB); + getOpcodeDef(G_INSERT_VECTOR_ELT, I.getOperand(1).getReg(), MRI); if (!InsMI) return false; // Match the undef vector operand. auto *UndefMI = - findMIFromReg(InsMI->getOperand(1).getReg(), G_IMPLICIT_DEF, MIB); + getOpcodeDef(G_IMPLICIT_DEF, InsMI->getOperand(1).getReg(), MRI); if (!UndefMI) return false; // Match the scalar being splatted. @@ -3342,7 +3331,7 @@ bool AArch64InstructionSelector::tryOptVectorDup(MachineInstr &I) const { return false; // The shuffle's second operand doesn't matter if the mask is all zero. - auto *ZeroVec = findMIFromReg(I.getOperand(3).getReg(), G_BUILD_VECTOR, MIB); + auto *ZeroVec = getOpcodeDef(G_BUILD_VECTOR, I.getOperand(3).getReg(), MRI); if (!ZeroVec) return false; int64_t Zero = 0; |

