summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/PHITransAddr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-09 17:27:45 +0000
committerChris Lattner <sabre@nondot.org>2009-12-09 17:27:45 +0000
commit9f9010ef472f215f61a8072533fe7d21c8a185a4 (patch)
tree71621a81240739ffaaa797f03c9d7b0640f8eb7b /llvm/lib/Analysis/PHITransAddr.cpp
parentd0a0bc34e34119ce29efb77531a3e286f1aeb07e (diff)
downloadbcm5719-llvm-9f9010ef472f215f61a8072533fe7d21c8a185a4.tar.gz
bcm5719-llvm-9f9010ef472f215f61a8072533fe7d21c8a185a4.zip
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
Diffstat (limited to 'llvm/lib/Analysis/PHITransAddr.cpp')
-rw-r--r--llvm/lib/Analysis/PHITransAddr.cpp4
1 files changed, 4 insertions, 0 deletions
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();
OpenPOWER on IntegriCloud