diff options
author | Manman Ren <mren@apple.com> | 2012-05-11 01:30:47 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2012-05-11 01:30:47 +0000 |
commit | 247c5ab07c1c136f37f5ad8ade9a1ee086ca452e (patch) | |
tree | 4fe950876dc2d1f1b6faf9002432103026a2f00c /lib/CodeGen/PeepholeOptimizer.cpp | |
parent | d4347e1af9141ec9f8e3e527367bfd16c0cc4ffb (diff) | |
download | external_llvm-247c5ab07c1c136f37f5ad8ade9a1ee086ca452e.zip external_llvm-247c5ab07c1c136f37f5ad8ade9a1ee086ca452e.tar.gz external_llvm-247c5ab07c1c136f37f5ad8ade9a1ee086ca452e.tar.bz2 |
ARM: peephole optimization to remove cmp instruction
This patch will optimize the following cases:
sub r1, r3 | sub r1, imm
cmp r3, r1 or cmp r1, r3 | cmp r1, imm
bge L1
TO
subs r1, r3
bge L1 or ble L1
If the branch instruction can use flag from "sub", then we can replace
"sub" with "subs" and eliminate the "cmp" instruction.
rdar: 10734411
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156599 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PeepholeOptimizer.cpp')
-rw-r--r-- | lib/CodeGen/PeepholeOptimizer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/PeepholeOptimizer.cpp b/lib/CodeGen/PeepholeOptimizer.cpp index 70b5020..ab672c9 100644 --- a/lib/CodeGen/PeepholeOptimizer.cpp +++ b/lib/CodeGen/PeepholeOptimizer.cpp @@ -31,6 +31,15 @@ // same flag that the "cmp" instruction sets and that "bz" uses, then we can // eliminate the "cmp" instruction. // +// Another instance, in this code: +// +// sub r1, r3 | sub r1, imm +// cmp r3, r1 or cmp r1, r3 | cmp r1, imm +// bge L1 +// +// If the branch instruction can use flag from "sub", then we can replace +// "sub" with "subs" and eliminate the "cmp" instruction. +// // - Optimize Bitcast pairs: // // v1 = bitcast v0 |