[PATCH] D66324: clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM
Paul Kirth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 14:35:35 PDT 2019
paulkirth marked 3 inline comments as done.
paulkirth added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/MisExpect.cpp:150
+ // Operand 0 is a string tag "branch_weights"
+ if (MDString *Tag = cast<MDString>(MD->getOperand(0))) {
+ unsigned NOps = MD->getNumOperands();
----------------
nickdesaulniers wrote:
> Sorry if I'm going back and forth on this, but it may make sense to check the number of operands first, before accessing any.
No problem. I've reintroduced the check. I was under the impression that metadata could not lack a 0th element, but even in that case I should have checked for additional elements.
There should always be at least 2 branch weights, otherwise branch weights are not necessary, and we should never end up here.
Should I add a comment saying that?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66324/new/
https://reviews.llvm.org/D66324
More information about the llvm-commits
mailing list