diff options
| author | Petar Avramovic <Petar.Avramovic@rt-rk.com> | 2019-01-24 10:09:52 +0000 |
|---|---|---|
| committer | Petar Avramovic <Petar.Avramovic@rt-rk.com> | 2019-01-24 10:09:52 +0000 |
| commit | b5a939d24653183947d5261f49609cc7c9ed1873 (patch) | |
| tree | ccbfecaf83b3c9c7516b2803497b65326ec19180 /llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp | |
| parent | a6982414edf315c39ae93f3c3322476217119e99 (diff) | |
| download | bcm5719-llvm-b5a939d24653183947d5261f49609cc7c9ed1873.tar.gz bcm5719-llvm-b5a939d24653183947d5261f49609cc7c9ed1873.zip | |
[MIPS GlobalISel] Combine extending loads
Use CombinerHelper to combine extending load instructions.
G_LOAD combined with G_ZEXT, G_SEXT or G_ANYEXT gives G_ZEXTLOAD,
G_SEXTLOAD or G_LOAD with same type as def of extending instruction
respectively.
Similarly G_ZEXTLOAD combined with G_ZEXT gives G_ZEXTLOAD and
G_SEXTLOAD combined with G_SEXT gives G_SEXTLOAD with same type
as def of extending instruction.
Differential Revision: https://reviews.llvm.org/D56914
llvm-svn: 352037
Diffstat (limited to 'llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp')
| -rw-r--r-- | llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp b/llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp index 243a0dae944..85076590d40 100644 --- a/llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp +++ b/llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp @@ -13,6 +13,7 @@ #include "MipsTargetMachine.h" #include "llvm/CodeGen/GlobalISel/Combiner.h" +#include "llvm/CodeGen/GlobalISel/CombinerHelper.h" #include "llvm/CodeGen/GlobalISel/CombinerInfo.h" #include "llvm/CodeGen/GlobalISel/MIPatternMatch.h" #include "llvm/CodeGen/TargetPassConfig.h" @@ -34,6 +35,16 @@ public: bool MipsPreLegalizerCombinerInfo::combine(GISelChangeObserver &Observer, MachineInstr &MI, MachineIRBuilder &B) const { + CombinerHelper Helper(Observer, B); + + switch (MI.getOpcode()) { + default: + return false; + case TargetOpcode::G_LOAD: + case TargetOpcode::G_SEXTLOAD: + case TargetOpcode::G_ZEXTLOAD: + return Helper.tryCombineExtendingLoads(MI); + } return false; } |

