diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-26 02:11:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-26 02:11:11 +0000 |
commit | 653b2581df384f5442ef2438b11864576e6b549b (patch) | |
tree | b18e0def314c2bed06d36610f0e31b4b57f3f102 | |
parent | 5eecb7f164a926540bc1bdffc7df81ab4ddce710 (diff) | |
download | external_llvm-653b2581df384f5442ef2438b11864576e6b549b.zip external_llvm-653b2581df384f5442ef2438b11864576e6b549b.tar.gz external_llvm-653b2581df384f5442ef2438b11864576e6b549b.tar.bz2 |
add a comment, make save/restore logic more obvious.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60076 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/CodeGenPrepare.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index 99dba6d..86168e8 100644 --- a/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/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; |