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 | ccd9796a46883adcc2b29003413a527f078692f7 (patch) | |
tree | ce82314570198d56d2bdce88a523ebc8dbe05f7b /lib/Target/X86/InstSelectSimple.cpp | |
parent | 5253f05709b11c93e807885e2af6e3302e7d3877 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14204 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/InstSelectSimple.cpp')
-rw-r--r-- | lib/Target/X86/InstSelectSimple.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Target/X86/InstSelectSimple.cpp b/lib/Target/X86/InstSelectSimple.cpp index 0c8b0a4566..598a979471 100644 --- a/lib/Target/X86/InstSelectSimple.cpp +++ b/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; |