summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-26 02:11:11 +0000
committerChris Lattner <sabre@nondot.org>2008-11-26 02:11:11 +0000
commit383a797f424b51ca4531936f40caae1b7c33b0fc (patch)
tree0002e487c7a90841269053e161e0d15db044054f
parenteb3e4fb6fbf703cee9b0e4e9f00ac41074bf211c (diff)
downloadbcm5719-llvm-383a797f424b51ca4531936f40caae1b7c33b0fc.tar.gz
bcm5719-llvm-383a797f424b51ca4531936f40caae1b7c33b0fc.zip
add a comment, make save/restore logic more obvious.
llvm-svn: 60076
-rw-r--r--llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 99dba6dda0d..86168e8af45 100644
--- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -864,22 +864,22 @@ bool AddressingModeMatcher::MatchAddr(Value *Addr, unsigned Depth) {
// Worse case, the target should support [reg] addressing modes. :)
if (!AddrMode.HasBaseReg) {
AddrMode.HasBaseReg = true;
+ AddrMode.BaseReg = Addr;
// Still check for legality in case the target supports [imm] but not [i+r].
- if (TLI.isLegalAddressingMode(AddrMode, AccessTy)) {
- AddrMode.BaseReg = Addr;
+ if (TLI.isLegalAddressingMode(AddrMode, AccessTy))
return true;
- }
AddrMode.HasBaseReg = false;
+ AddrMode.BaseReg = 0;
}
// If the base register is already taken, see if we can do [r+r].
if (AddrMode.Scale == 0) {
AddrMode.Scale = 1;
- if (TLI.isLegalAddressingMode(AddrMode, AccessTy)) {
- AddrMode.ScaledReg = Addr;
+ AddrMode.ScaledReg = Addr;
+ if (TLI.isLegalAddressingMode(AddrMode, AccessTy))
return true;
- }
AddrMode.Scale = 0;
+ AddrMode.ScaledReg = 0;
}
// Couldn't match.
return false;
@@ -954,7 +954,7 @@ cl::opt<bool> ENABLECRAZYHACK("enable-smarter-addr-folding", cl::Hidden);
///
/// Note that this (like most of CodeGenPrepare) is just a rough heuristic. If
/// X was live across 'load Z' for other reasons, we actually *would* want to
-/// fold the addressing mode in the Z case.
+/// fold the addressing mode in the Z case. This would make Y die earlier.
bool AddressingModeMatcher::
IsProfitableToFoldIntoAddressingMode(Instruction *I) {
if (IgnoreProfitability || !ENABLECRAZYHACK) return true;
OpenPOWER on IntegriCloud