diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/Instructions.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index ce281e0ed38..9dc753e960c 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -472,6 +472,15 @@ void CallInst::updateProfWeight(uint64_t S, uint64_t T) { !ProfDataName->getString().equals("VP"))) return; + if (T == 0) { + LLVM_DEBUG(dbgs() << "Attempting to update profile weights will result in " + "div by 0. Ignoring. Likely the function " + << getParent()->getParent()->getName() + << " has 0 entry count, and contains call instructions " + "with non-zero prof info."); + return; + } + MDBuilder MDB(getContext()); SmallVector<Metadata *, 3> Vals; Vals.push_back(ProfileData->getOperand(0)); |

