Do not attempt to do parial redundancy elimination on void values.
Also fixed a punctuation error in the header comment.
This fixes PR3775.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66542 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index 6593b9c..e537986 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -10,7 +10,7 @@
// This pass performs global value numbering to eliminate fully redundant
// instructions. It also performs simple dead load elimination.
//
-// Note that this pass does the value numbering itself, it does not use the
+// Note that this pass does the value numbering itself; it does not use the
// ValueNumbering analysis passes.
//
//===----------------------------------------------------------------------===//
@@ -1469,8 +1469,9 @@
Instruction *CurInst = BI++;
if (isa<AllocationInst>(CurInst) || isa<TerminatorInst>(CurInst) ||
- isa<PHINode>(CurInst) || CurInst->mayReadFromMemory() ||
- CurInst->mayWriteToMemory() || isa<DbgInfoIntrinsic>(CurInst))
+ isa<PHINode>(CurInst) || (CurInst->getType() == Type::VoidTy) ||
+ CurInst->mayReadFromMemory() || CurInst->mayWriteToMemory() ||
+ isa<DbgInfoIntrinsic>(CurInst))
continue;
uint32_t valno = VN.lookup(CurInst);