summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-09-29 23:40:12 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-09-29 23:40:12 +0000
commit48105286cbbe046d82d1a7e36a07d656d8ba2faf (patch)
treec4a48f9bebba8621ec8bc3cee1d312a9bc0c6f67 /lib/Transforms/Scalar/CodeGenPrepare.cpp
parent29f018cee616e4082e5005bc9adee4dc777e621c (diff)
downloadllvm-48105286cbbe046d82d1a7e36a07d656d8ba2faf.tar.gz
llvm-48105286cbbe046d82d1a7e36a07d656d8ba2faf.tar.bz2
llvm-48105286cbbe046d82d1a7e36a07d656d8ba2faf.tar.xz
Fold two identical set lookups into one. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140821 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/CodeGenPrepare.cpp')
-rw-r--r--lib/Transforms/Scalar/CodeGenPrepare.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 776b8f9b96..f8f18b2173 100644
--- a/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -735,13 +735,11 @@ bool CodeGenPrepare::OptimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
worklist.pop_back();
// Break use-def graph loops.
- if (Visited.count(V)) {
+ if (!Visited.insert(V)) {
Consensus = 0;
break;
}
- Visited.insert(V);
-
// For a PHI node, push all of its incoming values.
if (PHINode *P = dyn_cast<PHINode>(V)) {
for (unsigned i = 0, e = P->getNumIncomingValues(); i != e; ++i)
@@ -752,7 +750,7 @@ bool CodeGenPrepare::OptimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
// For non-PHIs, determine the addressing mode being computed.
SmallVector<Instruction*, 16> NewAddrModeInsts;
ExtAddrMode NewAddrMode =
- AddressingModeMatcher::Match(V, AccessTy,MemoryInst,
+ AddressingModeMatcher::Match(V, AccessTy, MemoryInst,
NewAddrModeInsts, *TLI);
// This check is broken into two cases with very similar code to avoid using