aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-08-05 11:23:46 +0000
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-08-05 11:23:46 +0000
commitc212125d2797bb41cb83c7cf6d0b65a2f61e24de (patch)
treec9673d8c1bccedb9bafe4b75921c5a663cb2e892 /llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
parent483b9fbddb66e0db6388bae44b73cad6f704c77f (diff)
downloadllvm-c212125d2797bb41cb83c7cf6d0b65a2f61e24de.zip
llvm-c212125d2797bb41cb83c7cf6d0b65a2f61e24de.tar.gz
llvm-c212125d2797bb41cb83c7cf6d0b65a2f61e24de.tar.bz2
[SystemZ] Use BRCT and BRCTG to eliminate add-&-compare sequences
This patch just uses a peephole test for "add; compare; branch" sequences within a single block. The IR optimizers already convert loops to decrement-and-branch-on-nonzero form in some cases, so even this simplistic test triggers many times during a clang bootstrap and projects/test-suite run. It looks like there are still cases where we need to more strongly prefer branches on nonzero though. E.g. I saw a case where a loop that started out with a check for 0 ended up with a check for -1. I'll try to look at that sometime. I ended up adding the Reference class because MachineInstr::readsRegister() doesn't check for subregisters (by design, as far as I could tell). llvm-svn: 187723
Diffstat (limited to 'llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp b/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
index 2bacc2bc..856183c 100644
--- a/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
@@ -82,6 +82,9 @@ bool SystemZPassConfig::addPreEmitPass() {
// CC values (while still being worthwhile) and others that happen to make
// the CC result more useful than it was originally.
//
+ // Another reason is that we only want to use BRANCH ON COUNT in cases
+ // where we know that the count register is not going to be spilled.
+ //
// Doing it so late makes it more likely that a register will be reused
// between the comparison and the branch, but it isn't clear whether
// preventing that would be a win or not.