aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2012-05-31 17:20:29 +0000
committerManman Ren <mren@apple.com>2012-05-31 17:20:29 +0000
commit91c5346d91973a1d3458a20f8c6b0e899b732e38 (patch)
treeeb29d9f46d2f9184cb248413cc98369f6179c089 /include
parent5ddc04caf25a649963c99be02646c3a9fc88d514 (diff)
downloadexternal_llvm-91c5346d91973a1d3458a20f8c6b0e899b732e38.zip
external_llvm-91c5346d91973a1d3458a20f8c6b0e899b732e38.tar.gz
external_llvm-91c5346d91973a1d3458a20f8c6b0e899b732e38.tar.bz2
X86: replace SUB with CMP if possible
This patch will optimize the following movq %rdi, %rax subq %rsi, %rax cmovsq %rsi, %rdi movq %rdi, %rax to cmpq %rsi, %rdi cmovsq %rsi, %rdi movq %rdi, %rax Perform this optimization if the actual result of SUB is not used. rdar: 11540023 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Target/TargetInstrInfo.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h
index d3c5e20..896c152 100644
--- a/include/llvm/Target/TargetInstrInfo.h
+++ b/include/llvm/Target/TargetInstrInfo.h
@@ -640,6 +640,14 @@ public:
return false;
}
+ /// OptimizeSubInstr - See if the SUB instruction can be converted into
+ /// something more efficient E.g., on X86, we can replace SUB with CMP
+ /// if the actual result of SUB is not used.
+ virtual bool OptimizeSubInstr(MachineInstr *SubInstr,
+ const MachineRegisterInfo *MRI) const {
+ return false;
+ }
+
/// FoldImmediate - 'Reg' is known to be defined by a move immediate
/// instruction, try to fold the immediate into the use instruction.
virtual bool FoldImmediate(MachineInstr *UseMI, MachineInstr *DefMI,