Add more test cases.<div>Vu<br><br><div class="gmail_quote">On Tue, Mar 1, 2011 at 12:15 PM, Vu Le <span dir="ltr"><<a href="mailto:vmle@ucdavis.edu">vmle@ucdavis.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Tue, Mar 1, 2011 at 12:12 PM, Vu Le <span dir="ltr"><<a href="mailto:vmle@ucdavis.edu" target="_blank">vmle@ucdavis.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
Hi Tobias,<br>Thanks for the feedback.<br><br><div class="gmail_quote"><div>On Tue, Mar 1, 2011 at 5:49 AM, Tobias Grosser <span dir="ltr"><<a href="mailto:grosser@fim.uni-passau.de" target="_blank">grosser@fim.uni-passau.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div>On 02/28/2011 02:52 PM, Vu Le wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
Hi Tobias,<div><br>
I did make some changes to use splitBlockPredecessors in splitting<br>
entry nodes.<br>
</div></blockquote>
<br>
Thanks for your fast reaction. The patch looks very nice. Though I have some comments that we need to fix before committing it.<div><br></div></blockquote></div><div>Thank you. <br></div><div><div></div><div>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div>
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
I tested it with coreutils and MySQL together with region-extractor pass.<br>
</blockquote></div>
Nice.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
If you're still interested in region-extractor pass, I'll make a patch.<br>
</blockquote></div>
Yes. I am extremely interested.<br>
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
diff --git a/include/llvm/InitializePasses.h b/include/llvm/InitializePasses.h<br>
index 02dbfbd..0591845 100644<br>
--- a/include/llvm/InitializePasses.h<br>
+++ b/include/llvm/InitializePasses.h<br>
@@ -192,6 +192,7 @@ void initializeRegionInfoPass(PassRegistry&);<br>
void initializeRegionOnlyPrinterPass(PassRegistry&);<br>
void initializeRegionOnlyViewerPass(PassRegistry&);<br>
void initializeRegionPrinterPass(PassRegistry&);<br>
+void initializeRegionSimplifyPass(PassRegistry&);<br>
void initializeRegionViewerPass(PassRegistry&);<br>
void initializeRegisterCoalescerAnalysisGroup(PassRegistry&);<br>
void initializeRenderMachineFunctionPass(PassRegistry&);<br>
diff --git a/include/llvm/LinkAllPasses.h b/include/llvm/LinkAllPasses.h<br>
index 69e1bd9..ea1faec 100644<br>
--- a/include/llvm/LinkAllPasses.h<br>
+++ b/include/llvm/LinkAllPasses.h<br>
@@ -114,7 +114,8 @@ namespace {<br>
(void) llvm::createRegionInfoPass();<br>
(void) llvm::createRegionOnlyPrinterPass();<br>
(void) llvm::createRegionOnlyViewerPass();<br>
- (void) llvm::createRegionPrinterPass();<br>
+ (void) llvm::createRegionPrinterPass();<br>
</blockquote>
This change does not seem to be needed. Please remove it.<br>
<br></blockquote></div></div><div>OK <br></div><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+ (void) llvm::createRegionSimplifyPass();<br>
(void) llvm::createRegionViewerPass();<br>
(void) llvm::createSCCPPass();<br>
(void) llvm::createScalarReplAggregatesPass();<br>
diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h<br>
index 6f2a38e..e3ca06a 100644<br>
--- a/include/llvm/Transforms/Scalar.h<br>
+++ b/include/llvm/Transforms/Scalar.h<br>
@@ -349,6 +349,12 @@ Pass *createCorrelatedValuePropagationPass();<br>
FunctionPass *createInstructionSimplifierPass();<br>
extern char&InstructionSimplifierID;<br>
<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+// RegionSimplify - Simplify refined regions, if possible.<br>
</blockquote>
Are there cases when it is not possible? Would be interesting to mention those.<br>
<br></blockquote></div><div>It is when a region has function entry as its entry and a single edge exit.<br>But then it is a simple region, I suppose.<br>I'll remove the "if possible" part.<br><br> </div><div>
<div></div><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+Pass *createRegionSimplifyPass();<br>
+<br>
} // End llvm namespace<br>
<br>
#endif<br>
diff --git a/lib/Transforms/Scalar/CMakeLists.txt b/lib/Transforms/Scalar/CMakeLists.txt<br>
index 106fb8f..53fcf69 100644<br>
--- a/lib/Transforms/Scalar/CMakeLists.txt<br>
+++ b/lib/Transforms/Scalar/CMakeLists.txt<br>
@@ -23,6 +23,7 @@ add_llvm_library(LLVMScalarOpts<br>
MemCpyOptimizer.cpp<br>
Reassociate.cpp<br>
Reg2Mem.cpp<br>
+ RegionSimplify.cpp<br>
SCCP.cpp<br>
Scalar.cpp<br>
ScalarReplAggregates.cpp<br>
diff --git a/lib/Transforms/Scalar/RegionSimplify.cpp b/lib/Transforms/Scalar/RegionSimplify.cpp<br>
new file mode 100644<br>
index 0000000..65e4d5c<br>
--- /dev/null<br>
+++ b/lib/Transforms/Scalar/RegionSimplify.cpp<br>
@@ -0,0 +1,185 @@<br>
+//===- SeSeRegionInfo.cpp -------------------------------------------------===//<br>
+//<br>
+// The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+// This file converts refined regions detected by the RegionInfo analysis<br>
+// into simple regions.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#include "llvm/Instructions.h"<br>
+#include "llvm/ADT/Statistic.h"<br>
+#include "llvm/Analysis/Dominators.h"<br>
+#include "llvm/Analysis/RegionPass.h"<br>
+#include "llvm/Analysis/RegionInfo.h"<br>
+#include "llvm/Transforms/Utils/BasicBlockUtils.h"<br>
+<br>
+#define DEBUG_TYPE "regionsimplify"<br>
</blockquote>
Can we call the pass "region-simplify"? Like "loop-simplify" (The name was recently changed)<br>
<br></blockquote></div></div><div>Sure <br></div><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+using namespace llvm;<br>
+<br>
+STATISTIC(NumEntries, "The # of created entry edges");<br>
+STATISTIC(NumExits, "The # of created exit edges");<br>
+<br>
+namespace {<br>
+class RegionSimplify: public RegionPass {<br>
+ bool modified;<br>
+ Region *CR;<br>
+ void createSingleEntryEdge(Region *R);<br>
+ void createSingleExitEdge(Region *R);<br>
+public:<br>
+ static char ID;<br>
+ explicit RegionSimplify() :<br>
+ RegionPass(ID) {<br>
+ initializeRegionSimplifyPass(*PassRegistry::getPassRegistry());<br>
+ }<br>
+<br>
+ virtual void print(raw_ostream&O, const Module *M) const;<br>
+<br>
+ virtual bool runOnRegion(Region *R, RGPassManager&RGM);<br>
+ virtual void getAnalysisUsage(AnalysisUsage&AU) const;<br>
+};<br>
+}<br>
+<br>
+INITIALIZE_PASS(RegionSimplify, "regionsimplify",<br>
</blockquote>
"regionsimplify" -> "region-simplify"<br></blockquote></div><div>OK <br></div><div><div></div><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+ "Transform refined regions into simple regions", false, false)<br>
+<br>
+char RegionSimplify::ID = 0;<br>
+namespace llvm {<br>
+Pass *createRegionSimplifyPass() {<br>
+ return new RegionSimplify();<br>
+}<br>
+}<br>
+<br>
+void RegionSimplify::print(raw_ostream&O, const Module *M) const {<div><br>
+ if (!modified)<br>
+ return;<br>
+<br>
+ BasicBlock *enteringBlock = CR->getEnteringBlock();<br>
+ BasicBlock *exitingBlock = CR->getExitingBlock();<br>
+<br></div><div>
+ O<< "\nRegion: ["<< CR->getNameStr()<< "] Edges:\n";<br>
+ if (enteringBlock)<br>
+ O<< " Entry: ]"<< enteringBlock->getNameStr()<< " => "<br>
+<< enteringBlock->getNameStr()<< "]\n";<br>
+ if (exitingBlock)<br>
+ O<< " Exit: ["<< exitingBlock->getNameStr()<< " => "<br>
+<< exitingBlock->getNameStr()<< "[\n";<br></div><div>
+<br>
+ O<< "\n";<br>
+}<br>
+<br>
+void RegionSimplify::getAnalysisUsage(AnalysisUsage&AU) const {<br>
+ AU.addPreserved<DominatorTree> ();<br></div>
+ AU.addPreserved<RegionInfo> ();<br>
+ AU.addRequired<RegionInfo> ();<br>
+}<br>
+<br>
+// createSingleEntryEdge - Split the entry basic block of the given<div><br>
+// region after the last PHINode to form a single entry edge.<br></div>
+void RegionSimplify::createSingleEntryEdge(Region *R) {<br>
+ BasicBlock *oldEntry = R->getEntry();<br>
+ SmallVector<BasicBlock*, 4> Preds;<div><br>
+ for (pred_iterator PI = pred_begin(oldEntry), PE = pred_end(oldEntry);<br>
+ PI != PE; ++PI)<br>
+ if (!R->contains(*PI))<br></div>
+ Preds.push_back(*PI);<br>
+<br>
+ if (Preds.size()==0)<br>
+ return;<br>
</blockquote>
Can we change this to an assert?<br>
<br>
assert(Preds.size() && "This region has already a single entry edge");<br></blockquote></div></div><div><br>Then we have to make sure that R's entry is not the function entry.<br>In runOnRegion<br> if (!(R->getEnteringBlock())<br>
&& (pred_begin(R->getEntry()) != pred_end(R->getEntry()))) {<br> createSingleEntryEdge(R);<br>...<br><br><br></div><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+<br>
+ BasicBlock *newEntry = SplitBlockPredecessors(oldEntry,<br>
+ Preds.data(), Preds.size(),<br>
+ ".single_entry", this);<br>
+<br>
+ RegionInfo *RI =&getAnalysis<RegionInfo> ();<br>
+ // We do not update entry node for children of this region.<br>
+ // This make it easier to extract children regions because they do not share<br>
+ // the entry node with their parents.<br>
+ // all parent regions whose entry is oldEntry are updated with newEntry<br>
+ Region *r = R->getParent();<br>
+ while (r->getEntry() == oldEntry&& !r->isTopLevelRegion()) {<br>
+ r->replaceEntry(newEntry);<br>
+ r = r->getParent();<br>
+ }<br>
+<br>
+ // We do not update exit node for children of this region for the same reason<br>
+ // of not updating entry node.<br>
+ // All other regions whose exit is oldEntry are updated with new exit node<br>
+ r = RI->getTopLevelRegion();<br>
</blockquote>
r = r->getParent() should be enough?<br></blockquote><div> </div></div><div>I don't think so. We want to find ALL other regions, not just the regions starting from<br>parent of R. We must start from the top.<br>
</div><div>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+ std::deque<Region *> RQ;<br>
</blockquote>
std::vector is probably simpler<br>
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+ RQ.push_back(r);<br>
+ while (!RQ.empty()){<br>
+ r = RQ.front();<br>
+ for (Region::const_iterator RI = r->begin(), RE = r->end(); RI!=RE; ++RI)<br>
+ RQ.push_back(*RI);<br>
+ if (r->getExit() == oldEntry&& !R->contains(r))<br>
+ r->replaceExit(newEntry);<br>
+ RQ.pop_front();<br>
+ }<br>
</blockquote>
I need to think about this part (Will send feedback later).<br></blockquote></div><div>This is not clean. Here is a cleaner version<br> r = RI->getTopLevelRegion();<br> std::vector<Region *> RQ;<div>
<br> RQ.push_back(r);<br>
<br> while (!RQ.empty()){<br></div><div> r = RQ.back();<br> RQ.pop_back();<br><br></div><div> if (r->getExit() != oldEntry || R->contains(r))<br></div> continue;<br><br> r->replaceExit(newEntry);<div>
<br><br> for (Region::const_iterator RI = r->begin(), RE = r->end(); RI!=RE; ++RI)<br>
RQ.push_back(*RI);<br> }<br></div></div></div></blockquote></div></div><div>Please ignore this code fragment. It should be like this:<div class="im"><br> r = RI->getTopLevelRegion();<br> std::vector<Region *> RQ;<br>
RQ.push_back(r);<br>
<br> while (!RQ.empty()){<br> r = RQ.back();<br> RQ.pop_back();<br><br></div><div class="im"> for (Region::const_iterator RI = r->begin(), RE = r->end(); RI!=RE; ++RI)<br> RQ.push_back(*RI);<br><br> if (r->getExit() == oldEntry && !R->contains(r))<br>
r->replaceExit(newEntry);<br> }<br><br> </div></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div class="gmail_quote"><div><div>
</div>We cannot make sure that those regions whose exit is OldEntry belong to any<div><div></div><div class="h5"><br>particular subregions. That's why we have to iterate over all the regions in the <br>tree.<br></div>
</div></div><div><div></div><div class="h5"><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+<br>
+ modified |= true;<br>
</blockquote>
I do not believe this is part of creating the edges. 'modified' is part of the status tracking of the pass and should probably be put into runOnRegion().<br>
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+ ++NumEntries;<br>
</blockquote>
Dito. Please put in runOnRegion().<br></blockquote></div><div>Sure. <br></div><div><div></div><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+}<br>
+<br>
+// createSingleExitEdge - Split the exit basic of the given region<div><br>
+// to form a single exit edge.<br></div>
+void RegionSimplify::createSingleExitEdge(Region *R) {<br>
+ BasicBlock *oldExit = R->getExit();<br>
+<br>
+ SmallVector<BasicBlock*, 4> Preds;<br>
+ for (pred_iterator PI = pred_begin(oldExit), PE = pred_end(oldExit);<div><br>
+ PI != PE; ++PI)<br>
+ if (R->contains(*PI))<br>
+ Preds.push_back(*PI);<br>
+<br></div>
+ BasicBlock *newExit = SplitBlockPredecessors(oldExit,<br>
+ Preds.data(), Preds.size(),<br>
+ ".single_exit", this);<br>
+ RegionInfo *RI =&getAnalysis<RegionInfo> ();<br>
+<br>
+ // We do not need to update entry nodes because this split happens inside<br>
+ // this region and it affects only this region and all of its children.<br>
+ // The new split node belongs to this region<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+ RI->setRegionFor(newExit,R);<br>
+<br>
+ // all children of this region whose exit is oldExit is changed to newExit<br>
+ std::deque<Region *> RQ;<br>
+ for (Region::const_iterator RI = R->begin(), RE = R->end(); RI!=RE; ++RI)<br>
+ RQ.push_back(*RI);<br>
+ while (!RQ.empty()){<br>
+ R = RQ.front();<br>
+ for (Region::const_iterator RI = R->begin(), RE = R->end(); RI!=RE; ++RI)<br>
+ RQ.push_back(*RI);<br>
+<br>
+ if (R->getExit() == oldExit)<br>
+ R->replaceExit(newExit);<br>
+ RQ.pop_front();<br>
+ }<br>
</blockquote>
<br>
A vector is probably simpler. We also do not need to add child regions for regions that do not have an exit matching oldExit. What about this code?<br></blockquote></div></div><div>I'm not sure about this.<br>A child might not share the exit with its parent. <br>
I think we still need to check.<br></div><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<br>
std::vector<Region *> RQ;<br>
<br>
while (!RQ.empty()){<br>
R = RQ.back();<br>
RQ.pop_back();<br>
<br>
if (R->getExit() != oldExit)<br>
continue;<br>
<br>
R->replaceExit(newExit);<br>
<br>
for (Region::const_iterator RI = R->begin(), RE = R->end(); RI!=RE;<br>
++RI)<br>
RQ.push_back(*RI);<br>
<br>
}<br>
<br></blockquote></div><div> std::vector<Region *> RQ;<div><br> for (Region::const_iterator RI = R->begin(), RE = R->end(); RI!=RE; ++RI)<br> RQ.push_back(*RI);<br><br> while (!RQ.empty()){<br>
</div> R = RQ.back();<br>
RQ.pop_back();<div><br><br> for (Region::const_iterator RI = R->begin(), RE = R->end(); RI!=RE; ++RI)<br> RQ.push_back(*RI);<br><br> if (R->getExit() == oldExit)<br> R->replaceExit(newExit);<br>
}<br>
<br></div></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+<br>
+ modified |= true;<br>
</blockquote><div>
This function always modifies the CFG. So no need to put additional logic here.<br>
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+ ++NumExits;<br>
</blockquote>
Dito.<br>
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+}<div><br>
+<br>
+bool RegionSimplify::runOnRegion(Region *R, RGPassManager&RGM) {<br></div><div>
+ modified = false;<br>
+<br>
+ CR = R;<br>
+ if (!R->isTopLevelRegion()) {<br>
+<br></div>
+ if (!(R->getEnteringBlock())) {<br>
+ createSingleEntryEdge(R);<br>
+ }<br>
</blockquote>
<br>
if (!(R->getEnteringBlock())) {<br>
createSingleEntryEdge(R);<br>
++NumEntries;<br>
modified = true.<br>
}<br></div></blockquote><div>We need to add additional check for the special case where R does not have<br>any predecessor.<br> <br> if (!(R->getEnteringBlock())<br> && (pred_begin(R->getEntry()) != pred_end(R->getEntry()))) {<br>
createSingleEntryEdge(R);<br> modified = true;<br> ++NumEntries;<br> }<br></div><div><div></div><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+<br>
+ if (!(R->getExitingBlock())) {<br>
+ modified |= createSingleExitEdge(R);<br>
</blockquote>
<br>
if (!(R->getExitingBlock())) {<br>
createSingleExitEdge(R);<br>
++NumExits;<br>
modified = true;<br>
}<br>
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div>
+ }<br>
+ }<br>
+<br>
+ return modified;<br>
+}<br>
diff --git a/lib/Transforms/Scalar/Scalar.cpp b/lib/Transforms/Scalar/Scalar.cpp<br>
index bf9ca6d..5d18f22 100644<br>
--- a/lib/Transforms/Scalar/Scalar.cpp<br>
+++ b/lib/Transforms/Scalar/Scalar.cpp<br>
@@ -51,6 +51,7 @@ void llvm::initializeScalarOpts(PassRegistry&Registry) {<br>
initializeMemCpyOptPass(Registry);<br>
initializeReassociatePass(Registry);<br>
initializeRegToMemPass(Registry);<br>
+ initializeRegionSimplifyPass(Registry);<br>
initializeSCCPPass(Registry);<br>
initializeIPSCCPPass(Registry);<br>
initializeSROA_DTPass(Registry);<br></div>
diff --git a/test/Transforms/RegionSimplify/dg.exp b/test/Transforms/RegionSimplify/dg.exp<br>
new file mode 100644<br>
index 0000000..f200589<br>
--- /dev/null<br>
+++ b/test/Transforms/RegionSimplify/dg.exp<br>
@@ -0,0 +1,3 @@<br>
+load_lib llvm.exp<br>
+<br>
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]<br>
diff --git a/test/Transforms/RegionSimplify/multi_exits.ll b/test/Transforms/RegionSimplify/multi_exits.ll<br>
new file mode 100644<br>
index 0000000..024971c<br>
--- /dev/null<br>
+++ b/test/Transforms/RegionSimplify/multi_exits.ll<br>
@@ -0,0 +1,15 @@<br>
+; RUN: opt -regionsimplify<br>
</blockquote>
<br>
Did you test this test case. I believe you should use a line like:<br>
<br>
; RUN: opt -regionsimplify %s<br>
<br>
Furthermore, we should also check the generated output.<br>
<br>
; RUN: opt -regionsimplify %s | FileCheck %s<br>
<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
+define void @f() nounwind {<br>
</blockquote>
; CHECK: @f()<br>
; CHECK: br label %"1"<br>
...<br>
<br>
Add after the CHECK lines the output you expect.<br>
<br>
The same comments apply to the other test files. I would also be interested to have some test files that include PHI-Nodes.<br>
<br>
Can you send out an updated patch?<br>
<br></blockquote></div></div><div>I'll look at FileCheck and create additional tests.<br>Thank you again for your help ;).<br> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
Thanks a lot<br>
Tobi<br>
</blockquote></div></div></div><br>
</blockquote></div><br>
</blockquote></div><br></div>