mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
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
This commit is contained in:
parent
13cea4ef6f
commit
f815117481
@ -1964,11 +1964,12 @@ void ISel::visitSimpleBinary(BinaryOperator &B, unsigned OperatorClass) {
|
|||||||
|
|
||||||
// Special case: op Reg, load [mem]
|
// Special case: op Reg, load [mem]
|
||||||
if (isa<LoadInst>(Op0) && !isa<LoadInst>(Op1) && Class != cLong &&
|
if (isa<LoadInst>(Op0) && !isa<LoadInst>(Op1) && Class != cLong &&
|
||||||
|
Op0->hasOneUse() &&
|
||||||
isSafeToFoldLoadIntoInstruction(*cast<LoadInst>(Op0), B))
|
isSafeToFoldLoadIntoInstruction(*cast<LoadInst>(Op0), B))
|
||||||
if (!B.swapOperands())
|
if (!B.swapOperands())
|
||||||
std::swap(Op0, Op1); // Make sure any loads are in the RHS.
|
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)) {
|
isSafeToFoldLoadIntoInstruction(*cast<LoadInst>(Op1), B)) {
|
||||||
|
|
||||||
unsigned Opcode;
|
unsigned Opcode;
|
||||||
|
Loading…
Reference in New Issue
Block a user