Change the order of the operands in patchAndReplaceAllUsesWith so

that they're more consistent with Value::replaceAllUsesWith.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176872 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2013-03-12 16:22:56 +00:00
parent 4d53e7798c
commit a15e708b1b

View File

@ -1714,7 +1714,7 @@ bool GVN::processNonLocalLoad(LoadInst *LI) {
return true; return true;
} }
static void patchReplacementInstruction(Value *Repl, Instruction *I) { static void patchReplacementInstruction(Instruction *I, Value *Repl) {
// Patch the replacement so that it is not more restrictive than the value // Patch the replacement so that it is not more restrictive than the value
// being replaced. // being replaced.
BinaryOperator *Op = dyn_cast<BinaryOperator>(I); BinaryOperator *Op = dyn_cast<BinaryOperator>(I);
@ -1756,8 +1756,8 @@ static void patchReplacementInstruction(Value *Repl, Instruction *I) {
} }
} }
static void patchAndReplaceAllUsesWith(Value *Repl, Instruction *I) { static void patchAndReplaceAllUsesWith(Instruction *I, Value *Repl) {
patchReplacementInstruction(Repl, I); patchReplacementInstruction(I, Repl);
I->replaceAllUsesWith(Repl); I->replaceAllUsesWith(Repl);
} }
@ -1919,7 +1919,7 @@ bool GVN::processLoad(LoadInst *L) {
} }
// Remove it! // Remove it!
patchAndReplaceAllUsesWith(AvailableVal, L); patchAndReplaceAllUsesWith(L, AvailableVal);
if (DepLI->getType()->getScalarType()->isPointerTy()) if (DepLI->getType()->getScalarType()->isPointerTy())
MD->invalidateCachedPointerInfo(DepLI); MD->invalidateCachedPointerInfo(DepLI);
markInstructionForDeletion(L); markInstructionForDeletion(L);
@ -2260,7 +2260,7 @@ bool GVN::processInstruction(Instruction *I) {
} }
// Remove it! // Remove it!
patchAndReplaceAllUsesWith(repl, I); patchAndReplaceAllUsesWith(I, repl);
if (MD && repl->getType()->getScalarType()->isPointerTy()) if (MD && repl->getType()->getScalarType()->isPointerTy())
MD->invalidateCachedPointerInfo(repl); MD->invalidateCachedPointerInfo(repl);
markInstructionForDeletion(I); markInstructionForDeletion(I);