diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-04 20:03:23 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-04 20:03:23 +0000 |
commit | 15fe30bcee9423d1c0af2d7711d549f336461f26 (patch) | |
tree | 2ad2ff7edcfb6f3c3f8d5c8e074535ad86b94f2a /lib/Transforms/Utils/PromoteMemoryToRegister.cpp | |
parent | 532b10c9d3fbea553d28d10e842b18ede18c74c0 (diff) | |
download | external_llvm-15fe30bcee9423d1c0af2d7711d549f336461f26.zip external_llvm-15fe30bcee9423d1c0af2d7711d549f336461f26.tar.gz external_llvm-15fe30bcee9423d1c0af2d7711d549f336461f26.tar.bz2 |
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%)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40818 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/PromoteMemoryToRegister.cpp')
-rw-r--r-- | lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index c586183..c0c7f65 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/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; |