diff options
| author | Devang Patel <dpatel@apple.com> | 2009-02-04 00:03:08 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2009-02-04 00:03:08 +0000 |
| commit | f10e287c65894d2bac0b19a99f8e9f0856a00eb0 (patch) | |
| tree | 68cbd6ae9aa5db0dacd56d94c72a8f8621ddcdac /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
| parent | 4193308b2a73344cf1b91480dabb8e97da8a1564 (diff) | |
| download | bcm5719-llvm-f10e287c65894d2bac0b19a99f8e9f0856a00eb0.tar.gz bcm5719-llvm-f10e287c65894d2bac0b19a99f8e9f0856a00eb0.zip | |
Ignore dbg intrinsics while hoisting common code in the two blocks up into the branch block.
llvm-svn: 63687
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 9f5df98fc0f..ea68abe22d9 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -853,7 +853,14 @@ static bool HoistThenElseCodeToIf(BranchInst *BI) { BasicBlock *BB1 = BI->getSuccessor(0); // The true destination. BasicBlock *BB2 = BI->getSuccessor(1); // The false destination - Instruction *I1 = BB1->begin(), *I2 = BB2->begin(); + BasicBlock::iterator BB1_Itr = BB1->begin(); + BasicBlock::iterator BB2_Itr = BB2->begin(); + + Instruction *I1 = BB1_Itr++, *I2 = BB2_Itr++; + while (isa<DbgInfoIntrinsic>(I1)) + I1 = BB1_Itr++; + while (isa<DbgInfoIntrinsic>(I2)) + I2 = BB2_Itr++; if (I1->getOpcode() != I2->getOpcode() || isa<PHINode>(I1) || isa<InvokeInst>(I1) || !I1->isIdenticalTo(I2)) return false; @@ -875,8 +882,12 @@ static bool HoistThenElseCodeToIf(BranchInst *BI) { I2->replaceAllUsesWith(I1); BB2->getInstList().erase(I2); - I1 = BB1->begin(); - I2 = BB2->begin(); + I1 = BB1_Itr++; + while (isa<DbgInfoIntrinsic>(I1)) + I1 = BB1_Itr++; + I2 = BB2_Itr++; + while (isa<DbgInfoIntrinsic>(I2)) + I2 = BB2_Itr++; } while (I1->getOpcode() == I2->getOpcode() && I1->isIdenticalTo(I2)); return true; |

