mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-10 02:36:06 +00:00
[PM] Switch tihs code to use a range based for loop over the function.
We can't switch the loop over the instructions because it needs to early-increment the iterator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226996 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fa50a1f2d5
commit
5999806daf
@ -143,20 +143,18 @@ static bool handleBranchExpect(BranchInst &BI) {
|
||||
}
|
||||
|
||||
bool LowerExpectIntrinsic::runOnFunction(Function &F) {
|
||||
for (Function::iterator I = F.begin(), E = F.end(); I != E;) {
|
||||
BasicBlock *BB = I++;
|
||||
|
||||
for (BasicBlock &BB : F) {
|
||||
// Create "block_weights" metadata.
|
||||
if (BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator())) {
|
||||
if (BranchInst *BI = dyn_cast<BranchInst>(BB.getTerminator())) {
|
||||
if (handleBranchExpect(*BI))
|
||||
IfHandled++;
|
||||
} else if (SwitchInst *SI = dyn_cast<SwitchInst>(BB->getTerminator())) {
|
||||
} else if (SwitchInst *SI = dyn_cast<SwitchInst>(BB.getTerminator())) {
|
||||
if (handleSwitchExpect(*SI))
|
||||
IfHandled++;
|
||||
}
|
||||
|
||||
// remove llvm.expect intrinsics.
|
||||
for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;) {
|
||||
for (BasicBlock::iterator BI = BB.begin(), BE = BB.end(); BI != BE;) {
|
||||
CallInst *CI = dyn_cast<CallInst>(BI++);
|
||||
if (!CI)
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user