[llvm-commits] [llvm] r113839 - /llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
Gabor Greif
ggreif at gmail.com
Tue Sep 14 02:23:22 PDT 2010
Author: ggreif
Date: Tue Sep 14 04:23:22 2010
New Revision: 113839
URL: http://llvm.org/viewvc/llvm-project?rev=113839&view=rev
Log:
Eliminate a 'tst' that immediately follows an 'and'
by morphing the 'and' to its recording form 'andS'.
This is basically a test commit into this area, to
see whether the bots like me. Several generalizations
can be applied and various avenues of code simplification
are open. I'll introduce those as I go.
I am aware of stylistic input from Bill Wendling, about
where put the analysis complexity, but I am positive
that we can move things around easily and will find a
satisfactory solution.
Modified:
llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=113839&r1=113838&r2=113839&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Tue Sep 14 04:23:22 2010
@@ -1372,6 +1372,19 @@
SrcReg = MI->getOperand(0).getReg();
CmpValue = MI->getOperand(1).getImm();
return true;
+ case ARM::TSTri: {
+ if (MI->getParent()->begin() == MachineBasicBlock::const_iterator(MI))
+ return false;
+ const MachineInstr *AND = llvm::prior(MI);
+ if (AND->getOpcode() != ARM::ANDri)
+ return false;
+ if (MI->getOperand(0).getReg() == AND->getOperand(1).getReg() &&
+ MI->getOperand(1).getImm() == AND->getOperand(2).getImm()) {
+ SrcReg = AND->getOperand(0).getReg();
+ CmpValue = 0;
+ return true;
+ }
+ }
}
return false;
@@ -1421,6 +1434,8 @@
switch (MI->getOpcode()) {
default: break;
case ARM::ADDri:
+ case ARM::ANDri:
+ case ARM::t2ANDri:
case ARM::SUBri:
case ARM::t2ADDri:
case ARM::t2SUBri:
More information about the llvm-commits
mailing list