diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-12-15 03:46:38 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-12-15 03:46:38 +0000 |
| commit | 69131fd872e4bcce495bb5392363e4aacbbfd0f4 (patch) | |
| tree | 794f401efca94bd5a4999d693ea70ab697615305 /llvm/lib | |
| parent | ff9f3dba12870a781633cdc287593aac57d8da17 (diff) | |
| download | bcm5719-llvm-69131fd872e4bcce495bb5392363e4aacbbfd0f4.tar.gz bcm5719-llvm-69131fd872e4bcce495bb5392363e4aacbbfd0f4.zip | |
make GVN try to rename inputs to the resultant replaced values, which
cleans up the generated code a bit. This should have the added benefit of
not randomly renaming functions/globals like my previous patch did. :)
llvm-svn: 61023
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/GVN.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index 8cfc62768f6..d3e15d457a4 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1040,6 +1040,9 @@ bool GVN::processNonLocalLoad(LoadInst *LI, // Perform PHI construction. Value* v = GetValueForBlock(LI->getParent(), LI, BlockReplValues, true); LI->replaceAllUsesWith(v); + + if (!isa<GlobalValue>(v)) + v->takeName(LI); if (isa<PointerType>(v->getType())) MD->invalidateCachedPointerInfo(v); toErase.push_back(LI); @@ -1135,7 +1138,8 @@ bool GVN::processNonLocalLoad(LoadInst *LI, // Perform PHI construction. Value* v = GetValueForBlock(LI->getParent(), LI, BlockReplValues, true); LI->replaceAllUsesWith(v); - v->takeName(LI); + if (!isa<GlobalValue>(v)) + v->takeName(LI); if (isa<PointerType>(v->getType())) MD->invalidateCachedPointerInfo(v); toErase.push_back(LI); |

