mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-12 22:30:12 +00:00
If we are extracting a basic block that ends in an invoke call, we must also
extract the landing pad block. Otherwise, there will be a situation where the invoke's unwind edge lands on a non-landing pad. We also forbid the user from extracting the landing pad block by itself. Again, this is not a valid transformation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140083 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
11f23c1a72
commit
ad027053fe
@ -664,7 +664,13 @@ ExtractCodeRegion(const std::vector<BasicBlock*> &code) {
|
|||||||
// * Pass in uses as args
|
// * Pass in uses as args
|
||||||
// 3) Move code region, add call instr to func
|
// 3) Move code region, add call instr to func
|
||||||
//
|
//
|
||||||
BlocksToExtract.insert(code.begin(), code.end());
|
for (std::vector<BasicBlock*>::const_iterator
|
||||||
|
I = code.begin(), E = code.end(); I != E; ++I) {
|
||||||
|
BasicBlock *BB = *I;
|
||||||
|
BlocksToExtract.insert(BB);
|
||||||
|
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
|
||||||
|
BlocksToExtract.insert(II->getUnwindDest());
|
||||||
|
}
|
||||||
|
|
||||||
Values inputs, outputs;
|
Values inputs, outputs;
|
||||||
|
|
||||||
@ -788,6 +794,7 @@ Function* llvm::ExtractLoop(DominatorTree &DT, Loop *L, bool AggregateArgs) {
|
|||||||
/// ExtractBasicBlock - slurp a basic block into a brand new function
|
/// ExtractBasicBlock - slurp a basic block into a brand new function
|
||||||
///
|
///
|
||||||
Function* llvm::ExtractBasicBlock(BasicBlock *BB, bool AggregateArgs) {
|
Function* llvm::ExtractBasicBlock(BasicBlock *BB, bool AggregateArgs) {
|
||||||
|
if (BB->isLandingPad()) return 0;
|
||||||
std::vector<BasicBlock*> Blocks;
|
std::vector<BasicBlock*> Blocks;
|
||||||
Blocks.push_back(BB);
|
Blocks.push_back(BB);
|
||||||
return CodeExtractor(0, AggregateArgs).ExtractCodeRegion(Blocks);
|
return CodeExtractor(0, AggregateArgs).ExtractCodeRegion(Blocks);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user