Changes in directory llvm/lib/Transforms/Scalar:
GVNPRE.cpp updated: 1.40 -> 1.41 --- Log message: Handle constants in phi nodes properly. This fixes test/Transforms/GVNPRE/2007-06-18-ConstantInPhi.ll --- Diffs of the changes: (+10 -1) GVNPRE.cpp | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.40 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.41 --- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.40 Tue Jun 19 00:37:32 2007 +++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Tue Jun 19 02:35:36 2007 @@ -927,7 +927,16 @@ for (std::set<Value*>::iterator I = S.begin(), E = S.end(); I != E; ++I) { - if (find_leader(anticIn, VN.lookup(*I)) == 0) + // For non-opaque values, we should already have a value numbering. + // However, for opaques, such as constants within PHI nodes, it is + // possible that they have not yet received a number. Make sure they do + // so now. + uint32_t valNum = 0; + if (isa<BinaryOperator>(*I) || isa<CmpInst>(*I)) + valNum = VN.lookup(*I); + else + valNum = VN.lookup_or_add(*I); + if (find_leader(anticIn, valNum) == 0) val_insert(anticIn, *I); } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits