From c69e4915750ac715fced8d63b9601899e8a4d0ae Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 4 Aug 2007 02:45:02 +0000 Subject: [PATCH] fix a logic bug where we wouldn't promote single store allocas if the stored value was a non-instruction value. Doh. This increase the # single store allocas from 8982 to 9026, and speeds up mem2reg on the testcase in PR1432 from 2.17 to 2.13s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40813 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 1106c6ea163..7520b22749d 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -557,7 +557,7 @@ void PromoteMem2Reg::RewriteSingleStoreAlloca(AllocaInst *AI, // do so now. We can't handle the case where the store doesn't dominate a // block because there may be a path between the store and the use, but we // may need to insert phi nodes to handle dominance properly. - if (StoringGlobalVal || !dominates(OnlyStore->getParent(), UseBlock)) + if (!StoringGlobalVal && !dominates(OnlyStore->getParent(), UseBlock)) continue; // If the use and store are in the same block, do a quick scan to @@ -569,7 +569,7 @@ void PromoteMem2Reg::RewriteSingleStoreAlloca(AllocaInst *AI, break; } if (&*I != OnlyStore) - break; // Do not handle this alloca. + continue; // Do not promote the uses of this in this block. } // Otherwise, if this is a different block or if all uses happen