summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/GVN.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2012-02-27 09:54:35 +0000
committerDuncan Sands <baldrick@free.fr>2012-02-27 09:54:35 +0000
commit5583e30818255281dc3b2122ec7207bf68b449ae (patch)
tree8f83f5458470a348020e57ec6d98d395034fd0e2 /lib/Transforms/Scalar/GVN.cpp
parent669011f50b8234bb4775d52a2d1e1ba5f6311e62 (diff)
downloadllvm-5583e30818255281dc3b2122ec7207bf68b449ae.tar.gz
llvm-5583e30818255281dc3b2122ec7207bf68b449ae.tar.bz2
llvm-5583e30818255281dc3b2122ec7207bf68b449ae.tar.xz
The value numbering function is recursive, so it is possible for multiple new
value numbers to be assigned when calculating any particular value number. Enhance the logic that detects new value numbers to take this into account, for a tiny compile time speedup. Fix a comment typo while there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151522 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/GVN.cpp')
-rw-r--r--lib/Transforms/Scalar/GVN.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index 68281e6620..06a8be0ba2 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -2144,7 +2144,7 @@ bool GVN::processInstruction(Instruction *I) {
}
// Instructions with void type don't return a value, so there's
- // no point in trying to find redudancies in them.
+ // no point in trying to find redundancies in them.
if (I->getType()->isVoidTy()) return false;
uint32_t NextNum = VN.getNextUnusedValueNumber();
@@ -2160,7 +2160,7 @@ bool GVN::processInstruction(Instruction *I) {
// If the number we were assigned was a brand new VN, then we don't
// need to do a lookup to see if the number already exists
// somewhere in the domtree: it can't!
- if (Num == NextNum) {
+ if (Num >= NextNum) {
addToLeaderTable(Num, I, I->getParent());
return false;
}