From 3546e6c894cd52633095f921b692955b4187d9aa Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Sun, 7 Feb 2016 01:52:15 +0000 Subject: [PATCH] Only insert into definingblocks once per block llvm-svn: 260013 --- lib/Transforms/Utils/MemorySSA.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Utils/MemorySSA.cpp b/lib/Transforms/Utils/MemorySSA.cpp index 382a18b025a..81c8737645b 100644 --- a/lib/Transforms/Utils/MemorySSA.cpp +++ b/lib/Transforms/Utils/MemorySSA.cpp @@ -253,17 +253,20 @@ MemorySSAWalker *MemorySSA::buildMemorySSA(AliasAnalysis *AA, // Go through each block, figure out where defs occur, and chain together all // the accesses. for (BasicBlock &B : F) { + bool InsertIntoDef = false; AccessListType *Accesses = nullptr; for (Instruction &I : B) { MemoryAccess *MA = createNewAccess(&I, true); if (!MA) continue; if (isa(MA)) - DefiningBlocks.insert(&B); + InsertIntoDef = true; if (!Accesses) Accesses = getOrCreateAccessList(&B); Accesses->push_back(MA); } + if (InsertIntoDef) + DefiningBlocks.insert(&B); } // Determine where our MemoryPhi's should go