[PATCH] D56491: treat invoke like call
David Callahan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 9 07:13:15 PST 2019
david2050 created this revision.
david2050 added reviewers: twoh, Kader, danielcdh, wmi.
Herald added a subscriber: llvm-commits.
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
Repository:
rL LLVM
https://reviews.llvm.org/D56491
Files:
lib/Transforms/Utils/AddDiscriminators.cpp
Index: lib/Transforms/Utils/AddDiscriminators.cpp
===================================================================
--- lib/Transforms/Utils/AddDiscriminators.cpp
+++ lib/Transforms/Utils/AddDiscriminators.cpp
@@ -232,15 +232,18 @@
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<CallInst>(I)) {
+ if (isa<IntrinsicInst>(I))
+ continue;
+ }
+ else if(!isa<InvokeInst>(I))
continue;
- DILocation *CurrentDIL = Current->getDebugLoc();
+ DILocation *CurrentDIL = I.getDebugLoc();
if (!CurrentDIL)
continue;
Location L =
@@ -255,7 +258,7 @@
<< CurrentDIL->getLine() << ":" << CurrentDIL->getColumn()
<< ":" << Discriminator << " " << I << "\n");
} else {
- Current->setDebugLoc(NewDIL.getValue());
+ I.setDebugLoc(NewDIL.getValue());
Changed = true;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56491.180839.patch
Type: text/x-patch
Size: 1320 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190109/bff0bddb/attachment.bin>
More information about the llvm-commits
mailing list