[llvm-commits] [parallel] CVS: llvm/lib/Transforms/Parallel/BreakJoinBlocks.cpp
Misha Brukman
brukman at cs.uiuc.edu
Mon May 17 19:21:01 PDT 2004
Changes in directory llvm/lib/Transforms/Parallel:
BreakJoinBlocks.cpp updated: 1.1.2.1 -> 1.1.2.2
---
Log message:
* Also consider LLVM thread start calls, not just the intrinsic
* Split before and after the join, so that it's the only remaining part of the
basic block, apart from the terminator
---
Diffs of the changes: (+15 -4)
Index: llvm/lib/Transforms/Parallel/BreakJoinBlocks.cpp
diff -u llvm/lib/Transforms/Parallel/BreakJoinBlocks.cpp:1.1.2.1 llvm/lib/Transforms/Parallel/BreakJoinBlocks.cpp:1.1.2.2
--- llvm/lib/Transforms/Parallel/BreakJoinBlocks.cpp:1.1.2.1 Thu May 6 11:34:58 2004
+++ llvm/lib/Transforms/Parallel/BreakJoinBlocks.cpp Mon May 17 19:20:27 2004
@@ -11,9 +11,10 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/iOther.h"
-#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
+#include "llvm/Function.h"
+#include "llvm/iOther.h"
+#include "llvm/iTerminators.h"
#include "llvm/Pass.h"
#include "llvm/Transforms/Utils/FunctionUtils.h"
using namespace llvm;
@@ -44,9 +45,18 @@
BasicBlock *BB = Worklist.back();
Worklist.pop_back();
if (CallInst *CI = findJoin(BB)) {
+ // Break away everything after the join
+ BasicBlock::iterator Next(CI); ++Next;
+ if (!isa<TerminatorInst>(Next) || isa<ReturnInst>(Next)) {
+ BasicBlock *newBB =
+ BB->splitBasicBlock(Next, BB->getName() + "_postsplit");
+ if (newBB) Worklist.push_back(newBB);
+ }
+
+ // Break away the join from anything before it
BasicBlock::iterator II(CI);
if (II != BB->begin()) {
- BasicBlock *newBB = BB->splitBasicBlock(II, BB->getName() + "_split");
+ BasicBlock *newBB = BB->splitBasicBlock(II, BB->getName() +"_presplit");
if (newBB) Worklist.push_back(newBB);
}
}
@@ -58,7 +68,8 @@
CallInst* BreakJoin::findJoin(BasicBlock *BB) {
for (BasicBlock::iterator i = BB->begin(), e = BB->end(); i != e; ++i)
if (CallInst *CI = dyn_cast<CallInst>(i))
- if (CI->getCalledFunction()->getName() == "llvm.join")
+ if (CI->getCalledFunction()->getName() == "llvm.join" ||
+ CI->getCalledFunction()->getName() == "__llvm_thread_join")
return CI;
return 0;
More information about the llvm-commits
mailing list