From cdb51c9ac4313a9cd2a5448d8916b23236d839c7 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Mon, 11 Jun 2007 16:25:17 +0000 Subject: [PATCH] Handle functions with multiple exit blocks properly. llvm-svn: 37539 --- lib/Transforms/Scalar/GVNPRE.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp index 6a36ea3d010..c43603e6ddc 100644 --- a/lib/Transforms/Scalar/GVNPRE.cpp +++ b/lib/Transforms/Scalar/GVNPRE.cpp @@ -526,6 +526,9 @@ bool GVNPRE::runOnFunction(Function &F) { df_begin(PDT.getRootNode()), E = df_end(PDT.getRootNode()); PDI != E; ++PDI) { BasicBlock* BB = PDI->getBlock(); + if (BB == 0) + continue; + DOUT << "Block: " << BB->getName() << "\n"; DOUT << "TMP_GEN: "; dump(generatedTemporaries[BB]); @@ -635,6 +638,9 @@ bool GVNPRE::runOnFunction(Function &F) { E = df_end(DT.getRootNode()); DI != E; ++DI) { BasicBlock* BB = DI->getBlock(); + if (BB == 0) + continue; + std::set& new_set = new_sets[BB]; std::set& availOut = availableOut[BB]; std::set& anticIn = anticipatedIn[BB];