[PATCH] D22228: Fix the assertion failure caused by http://reviews.llvm.org/D22118
Dehao Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 11 10:39:29 PDT 2016
danielcdh created this revision.
danielcdh added reviewers: dnovillo, mkuper.
danielcdh added a subscriber: llvm-commits.
http://reviews.llvm.org/D22118 uses metadata to store the call count, which makes it possible to have branch weight to have only one elements. Also fix the assertion failure in inliner when checking the instruction type to include "invoke" instruction.
http://reviews.llvm.org/D22228
Files:
lib/IR/MDBuilder.cpp
lib/IR/Metadata.cpp
Index: lib/IR/Metadata.cpp
===================================================================
--- lib/IR/Metadata.cpp
+++ lib/IR/Metadata.cpp
@@ -1315,7 +1315,8 @@
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;
Index: lib/IR/MDBuilder.cpp
===================================================================
--- lib/IR/MDBuilder.cpp
+++ lib/IR/MDBuilder.cpp
@@ -40,7 +40,7 @@
}
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");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22228.63536.patch
Type: text/x-patch
Size: 1040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160711/8269b35c/attachment.bin>
More information about the llvm-commits
mailing list