[llvm-commits] [parallel] CVS: llvm/lib/Transforms/Parallel/ParallelCallsToThreads.cpp
Misha Brukman
brukman at cs.uiuc.edu
Sat Apr 17 20:11:01 PDT 2004
Changes in directory llvm/lib/Transforms/Parallel:
ParallelCallsToThreads.cpp updated: 1.1.2.1 -> 1.1.2.2
---
Log message:
Correctly emit calls to __llvm_thread_join()
---
Diffs of the changes: (+7 -8)
Index: llvm/lib/Transforms/Parallel/ParallelCallsToThreads.cpp
diff -u llvm/lib/Transforms/Parallel/ParallelCallsToThreads.cpp:1.1.2.1 llvm/lib/Transforms/Parallel/ParallelCallsToThreads.cpp:1.1.2.2
--- llvm/lib/Transforms/Parallel/ParallelCallsToThreads.cpp:1.1.2.1 Fri Apr 16 12:27:58 2004
+++ llvm/lib/Transforms/Parallel/ParallelCallsToThreads.cpp Sat Apr 17 20:10:58 2004
@@ -67,8 +67,8 @@
for (ParallelInfo::iterator i = PI.begin(), e = PI.end(); i != e; ++i) {
ParallelSeq *PS = *i;
std::vector<Value*> JoinValues;
- for (ParallelSeq::region_iterator r = PS->region_begin(),
- re = PS->region_end(); r != re; ++r) {
+ for (ParallelSeq::riterator r = PS->rbegin(),
+ re = PS->rend(); r != re; ++r) {
ParallelRegion *PR = *r;
std::vector<BasicBlock*> RegionBlocks(PR->begin(), PR->end());
@@ -97,6 +97,7 @@
Args.push_back(funcPtr);
Args.push_back(funcVal);
CallInst *ThCreateCall = new CallInst(ThCreate, Args, "threadCall", TI);
+ JoinValues.push_back(ThCreateCall);
OldCall->getParent()->getInstList().erase(OldCall);
@@ -114,12 +115,10 @@
assert(JoinCall && "Pbr result used in something other than call!");
Function *ThJoin = getFuncThreadJoin(*F.getParent());
- for (std::vector<Value*>::iterator i = JoinValues.begin(),
- e = JoinValues.end(); i != e; ++i)
- CallInst *Join = new CallInst(ThJoin, *i, "join", JoinCall);
-
- if (JoinValues.size() > 0)
- JoinCall->getParent()->getInstList().erase(JoinCall);
+ TerminatorInst *JoinBBTerm = JoinCall->getParent()->getTerminator();
+ for (std::vector<Value*>::iterator val = JoinValues.begin(),
+ ve = JoinValues.end(); val != ve; ++val)
+ CallInst *Join = new CallInst(ThJoin, *val, "", JoinBBTerm);
}
return Changed;
More information about the llvm-commits
mailing list