From 9f9010ef472f215f61a8072533fe7d21c8a185a4 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 9 Dec 2009 17:27:45 +0000 Subject: Add a minor optimization: if we haven't changed the operands of an add, there is no need to scan the world to find the same add again. This invalidates the previous testcase, which wasn't wonderful anyway, because it needed a run of instcombine to permute the use-lists in just the right way to before GVN was run (so it was really fragile). Not a big loss. llvm-svn: 90973 --- llvm/lib/Analysis/PHITransAddr.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/Analysis') diff --git a/llvm/lib/Analysis/PHITransAddr.cpp b/llvm/lib/Analysis/PHITransAddr.cpp index a1b2afbaf7f..07e291971a8 100644 --- a/llvm/lib/Analysis/PHITransAddr.cpp +++ b/llvm/lib/Analysis/PHITransAddr.cpp @@ -275,6 +275,10 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB, RemoveInstInputs(LHS, InstInputs); return AddAsInput(Res); } + + // If we didn't modify the add, just return it. + if (LHS == Inst->getOperand(0) && RHS == Inst->getOperand(1)) + return Inst; // Otherwise, see if we have this add available somewhere. for (Value::use_iterator UI = LHS->use_begin(), E = LHS->use_end(); -- cgit v1.2.3