diff options
author | Chris Lattner <sabre@nondot.org> | 2004-06-17 22:15:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-06-17 22:15:25 +0000 |
commit | 7887da36de808374fa39f66eef5ac20bf2e56bc2 (patch) | |
tree | 5ff60d6c630db61315fb29bc95b518edf6802236 /llvm/lib | |
parent | f03f320b79e20f83fc1eaf92650c16851a056987 (diff) | |
download | bcm5719-llvm-7887da36de808374fa39f66eef5ac20bf2e56bc2.tar.gz bcm5719-llvm-7887da36de808374fa39f66eef5ac20bf2e56bc2.zip |
Do not fold loads into instructions if it is used more than once. In particular
we do not want to fold the load in cases like this:
X = load
= add A, X
= add B, X
llvm-svn: 14204
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/InstSelectSimple.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/InstSelectSimple.cpp b/llvm/lib/Target/X86/InstSelectSimple.cpp index 0c8b0a45667..598a979471a 100644 --- a/llvm/lib/Target/X86/InstSelectSimple.cpp +++ b/llvm/lib/Target/X86/InstSelectSimple.cpp @@ -1964,11 +1964,12 @@ void ISel::visitSimpleBinary(BinaryOperator &B, unsigned OperatorClass) { // Special case: op Reg, load [mem] if (isa<LoadInst>(Op0) && !isa<LoadInst>(Op1) && Class != cLong && + Op0->hasOneUse() && isSafeToFoldLoadIntoInstruction(*cast<LoadInst>(Op0), B)) if (!B.swapOperands()) std::swap(Op0, Op1); // Make sure any loads are in the RHS. - if (isa<LoadInst>(Op1) && Class != cLong && + if (isa<LoadInst>(Op1) && Class != cLong && Op1->hasOneUse() && isSafeToFoldLoadIntoInstruction(*cast<LoadInst>(Op1), B)) { unsigned Opcode; |