summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
diff options
context:
space:
mode:
authorDavid Callahan <dcallahan@fb.com>2019-01-15 21:26:51 +0000
committerDavid Callahan <dcallahan@fb.com>2019-01-15 21:26:51 +0000
commitd129d3e93fd58e7d7c323f5f704d81e4cd2f82dd (patch)
tree1e64610ee57f95ad396e959a86c178e660d49ef6 /llvm/lib/Transforms/Utils/AddDiscriminators.cpp
parent5b73c9bf27677c9954df48effa5786e060afd301 (diff)
downloadbcm5719-llvm-d129d3e93fd58e7d7c323f5f704d81e4cd2f82dd.tar.gz
bcm5719-llvm-d129d3e93fd58e7d7c323f5f704d81e4cd2f82dd.zip
treat invoke like call
Summary: InvokeInst should be treated like CallInst and assigned a separate discriminator. This is particularly import when an Invoke is converted to a Call during compilation and so can invalidate sample profile data collected wtih different link time optimizations Reviewers: twoh, Kader, danielcdh, wmi Reviewed By: wmi Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D56491 llvm-svn: 351251
Diffstat (limited to 'llvm/lib/Transforms/Utils/AddDiscriminators.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/AddDiscriminators.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
index 1e0fd5588ca..564537af0c2 100644
--- a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
+++ b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
@@ -232,15 +232,14 @@ static bool addDiscriminators(Function &F) {
for (BasicBlock &B : F) {
LocationSet CallLocations;
for (auto &I : B.getInstList()) {
- CallInst *Current = dyn_cast<CallInst>(&I);
// We bypass intrinsic calls for the following two reasons:
// 1) We want to avoid a non-deterministic assigment of
// discriminators.
// 2) We want to minimize the number of base discriminators used.
- if (!Current || isa<IntrinsicInst>(&I))
+ if (!isa<InvokeInst>(I) && (!isa<CallInst>(I) || isa<IntrinsicInst>(I)))
continue;
- DILocation *CurrentDIL = Current->getDebugLoc();
+ DILocation *CurrentDIL = I.getDebugLoc();
if (!CurrentDIL)
continue;
Location L =
@@ -255,7 +254,7 @@ static bool addDiscriminators(Function &F) {
<< CurrentDIL->getLine() << ":" << CurrentDIL->getColumn()
<< ":" << Discriminator << " " << I << "\n");
} else {
- Current->setDebugLoc(NewDIL.getValue());
+ I.setDebugLoc(NewDIL.getValue());
Changed = true;
}
}
OpenPOWER on IntegriCloud