Ignore PhiNodes when mapping sample profile data

Summary: Like branch instructions, phi nodes frequently do not have debug information related to the block they are in and so they should be ignored.

Reviewers: danielcdh, twoh, Kader, wmi

Reviewed By: wmi

Subscribers: aprantl, llvm-commits

Differential Revision: https://reviews.llvm.org/D55094

llvm-svn: 351102
This commit is contained in:
David Callahan 2019-01-14 19:05:59 +00:00
parent 1f3ab98aca
commit 957795973b
1 changed files with 3 additions and 3 deletions

View File

@ -544,10 +544,10 @@ ErrorOr<uint64_t> SampleProfileLoader::getInstWeight(const Instruction &Inst) {
if (!FS)
return std::error_code();
// Ignore all intrinsics and branch instructions.
// Branch instruction usually contains debug info from sources outside of
// Ignore all intrinsics, phinodes and branch instructions.
// Branch and phinodes instruction usually contains debug info from sources outside of
// the residing basic block, thus we ignore them during annotation.
if (isa<BranchInst>(Inst) || isa<IntrinsicInst>(Inst))
if (isa<BranchInst>(Inst) || isa<IntrinsicInst>(Inst) || isa<PHINode>(Inst))
return std::error_code();
// If a direct call/invoke instruction is inlined in profile