diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -1417,6 +1417,7 @@ getOpcode() == Instruction::Select || getOpcode() == Instruction::Call || getOpcode() == Instruction::Invoke || + getOpcode() == Instruction::IndirectBr || getOpcode() == Instruction::Switch) && "Looking for branch weights on something besides branch"); diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -1472,7 +1472,8 @@ Instruction *TI = BB->getTerminator(); if (TI->getNumSuccessors() == 1) continue; - if (!isa(TI) && !isa(TI)) + if (!isa(TI) && !isa(TI) && + !isa(TI)) continue; DebugLoc BranchLoc = TI->getDebugLoc();