[llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp
Owen Anderson
resistor at mac.com
Tue Jun 5 15:12:11 PDT 2007
Changes in directory llvm/lib/Transforms/Scalar:
GVNPRE.cpp updated: 1.19 -> 1.20
---
Log message:
Don't leak memory.
---
Diffs of the changes: (+6 -3)
GVNPRE.cpp | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp
diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.19 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.20
--- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.19 Tue Jun 5 12:31:23 2007
+++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Tue Jun 5 17:11:49 2007
@@ -158,11 +158,14 @@
Value* newVal = BinaryOperator::create(BO->getOpcode(),
newOp1, newOp2,
BO->getName()+".gvnpre");
- add(VN, MS, newVal);
- if (!find_leader(VN, set, VN[newVal]))
+
+ if (!find_leader(VN, set, VN[newVal])) {
+ add(VN, MS, newVal);
return newVal;
- else
+ } else {
+ delete newVal;
return 0;
+ }
}
} else if (PHINode* P = dyn_cast<PHINode>(V)) {
if (P->getParent() == pred->getTerminator()->getSuccessor(0))
More information about the llvm-commits
mailing list