summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/IR/MDBuilder.cpp2
-rw-r--r--llvm/lib/IR/Metadata.cpp3
2 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/IR/MDBuilder.cpp b/llvm/lib/IR/MDBuilder.cpp
index 4ce3ea2e9c0..a5a4cd06db0 100644
--- a/llvm/lib/IR/MDBuilder.cpp
+++ b/llvm/lib/IR/MDBuilder.cpp
@@ -40,7 +40,7 @@ MDNode *MDBuilder::createBranchWeights(uint32_t TrueWeight,
}
MDNode *MDBuilder::createBranchWeights(ArrayRef<uint32_t> Weights) {
- assert(Weights.size() >= 2 && "Need at least two branch weights!");
+ assert(Weights.size() >= 1 && "Need at least one branch weights!");
SmallVector<Metadata *, 4> Vals(Weights.size() + 1);
Vals[0] = createString("branch_weights");
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 24817b33142..5201c2ecce6 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -1315,7 +1315,8 @@ bool Instruction::extractProfMetadata(uint64_t &TrueVal, uint64_t &FalseVal) {
bool Instruction::extractProfTotalWeight(uint64_t &TotalVal) {
assert((getOpcode() == Instruction::Br ||
getOpcode() == Instruction::Select ||
- getOpcode() == Instruction::Call) &&
+ getOpcode() == Instruction::Call ||
+ getOpcode() == Instruction::Invoke) &&
"Looking for branch weights on something besides branch");
TotalVal = 0;
OpenPOWER on IntegriCloud