summaryrefslogtreecommitdiff
path: root/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
commit4d3a16f81b2a0f0211b58f2c1e5a28e2bbd432c7 (patch)
tree3ca580ee7ed42fff4cc9bc1d98c37ec893e38d07 /lib/Analysis/PHITransAddr.cpp
parent16f1692dca19431768e6f113af4acac470f8adf8 (diff)
downloadllvm-4d3a16f81b2a0f0211b58f2c1e5a28e2bbd432c7.tar.gz
llvm-4d3a16f81b2a0f0211b58f2c1e5a28e2bbd432c7.tar.bz2
llvm-4d3a16f81b2a0f0211b58f2c1e5a28e2bbd432c7.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90973 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PHITransAddr.cpp')
-rw-r--r--lib/Analysis/PHITransAddr.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Analysis/PHITransAddr.cpp b/lib/Analysis/PHITransAddr.cpp
index a1b2afbaf7..07e291971a 100644
--- a/lib/Analysis/PHITransAddr.cpp
+++ b/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();