summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-08-04 20:03:23 +0000
committerChris Lattner <sabre@nondot.org>2007-08-04 20:03:23 +0000
commit6b04ecbaf96ab5901b9d081f31b0fbe49e677e7e (patch)
tree28ecd4a4fbd05a2aac7afe34becec768dec85626 /llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
parent4a930f9444ae17eb683278015a0279aa12191c52 (diff)
downloadbcm5719-llvm-6b04ecbaf96ab5901b9d081f31b0fbe49e677e7e.tar.gz
bcm5719-llvm-6b04ecbaf96ab5901b9d081f31b0fbe49e677e7e.zip
Promoting allocas with the 'single store' fastpath is
faster than with the 'local to a block' fastpath. This speeds up PR1432 from 2.1232 to 2.0686s (2.6%) llvm-svn: 40818
Diffstat (limited to 'llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index c5861832a1a..c0c7f656227 100644
--- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -273,16 +273,6 @@ void PromoteMem2Reg::run() {
// analogous to finding the 'uses' and 'definitions' of each variable.
Info.AnalyzeAlloca(AI);
- // If the alloca is only read and written in one basic block, just perform a
- // linear sweep over the block to eliminate it.
- if (Info.OnlyUsedInOneBlock) {
- LocallyUsedAllocas[Info.OnlyBlock].push_back(AI);
-
- // Remove the alloca from the Allocas list, since it will be processed.
- RemoveFromAllocasList(AllocaNum);
- continue;
- }
-
// If there is only a single store to this value, replace any loads of
// it that are directly dominated by the definition with the value stored.
if (Info.DefiningBlocks.size() == 1) {
@@ -303,6 +293,15 @@ void PromoteMem2Reg::run() {
}
}
+ // If the alloca is only read and written in one basic block, just perform a
+ // linear sweep over the block to eliminate it.
+ if (Info.OnlyUsedInOneBlock) {
+ LocallyUsedAllocas[Info.OnlyBlock].push_back(AI);
+
+ // Remove the alloca from the Allocas list, since it will be processed.
+ RemoveFromAllocasList(AllocaNum);
+ continue;
+ }
if (AST)
PointerAllocaValues[AllocaNum] = Info.AllocaPointerVal;
OpenPOWER on IntegriCloud