[llvm] r344625 - [NFC][ARM] Refactor macro fusion
Evandro Menezes via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 16 10:19:51 PDT 2018
Author: evandro
Date: Tue Oct 16 10:19:51 2018
New Revision: 344625
URL: http://llvm.org/viewvc/llvm-project?rev=344625&view=rev
Log:
[NFC][ARM] Refactor macro fusion
Simplify code for wildcards.
Modified:
llvm/trunk/lib/Target/ARM/ARMMacroFusion.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMMacroFusion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMMacroFusion.cpp?rev=344625&r1=344624&r2=344625&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMMacroFusion.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMMacroFusion.cpp Tue Oct 16 10:19:51 2018
@@ -23,20 +23,13 @@ namespace llvm {
static bool isAESPair(const MachineInstr *FirstMI,
const MachineInstr &SecondMI) {
// Assume the 1st instr to be a wildcard if it is unspecified.
- unsigned FirstOpcode =
- FirstMI ? FirstMI->getOpcode()
- : static_cast<unsigned>(ARM::INSTRUCTION_LIST_END);
- unsigned SecondOpcode = SecondMI.getOpcode();
-
- switch(SecondOpcode) {
+ switch(SecondMI.getOpcode()) {
// AES encode.
case ARM::AESMC :
- return FirstOpcode == ARM::AESE ||
- FirstOpcode == ARM::INSTRUCTION_LIST_END;
+ return FirstMI == nullptr || FirstMI->getOpcode() == ARM::AESE;
// AES decode.
case ARM::AESIMC:
- return FirstOpcode == ARM::AESD ||
- FirstOpcode == ARM::INSTRUCTION_LIST_END;
+ return FirstMI == nullptr || FirstMI->getOpcode() == ARM::AESD;
}
return false;
@@ -46,15 +39,8 @@ static bool isAESPair(const MachineInstr
static bool isLiteralsPair(const MachineInstr *FirstMI,
const MachineInstr &SecondMI) {
// Assume the 1st instr to be a wildcard if it is unspecified.
- unsigned FirstOpcode =
- FirstMI ? FirstMI->getOpcode()
- : static_cast<unsigned>(ARM::INSTRUCTION_LIST_END);
- unsigned SecondOpcode = SecondMI.getOpcode();
-
- // 32 bit immediate.
- if ((FirstOpcode == ARM::INSTRUCTION_LIST_END ||
- FirstOpcode == ARM::MOVi16) &&
- SecondOpcode == ARM::MOVTi16)
+ if ((FirstMI == nullptr || FirstMI->getOpcode() == ARM::MOVi16) &&
+ SecondMI.getOpcode() == ARM::MOVTi16)
return true;
return false;
More information about the llvm-commits
mailing list