diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-20 00:56:55 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-20 00:56:55 +0000 |
commit | 41a1546ebcd07c27ac46bc9858159e7ba6532d1d (patch) | |
tree | 02fa198bd648f86530b17e75e88fb20a9e61babe /llvm/lib/Transforms | |
parent | 7ea96c222fc4647ada08b2221d38628a74fdf87a (diff) | |
download | bcm5719-llvm-41a1546ebcd07c27ac46bc9858159e7ba6532d1d.tar.gz bcm5719-llvm-41a1546ebcd07c27ac46bc9858159e7ba6532d1d.zip |
SampleProfile: Check for missing debug locations
Don't use `DebugLoc` accessors if we're pointing at null, which will be
a problem after a WIP patch to make the `DIDescriptor` accessors more
strict. Caught by Frontend/profile-sample-use-loc-tracking.c (in
clang).
llvm-svn: 232792
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SampleProfile.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/SampleProfile.cpp b/llvm/lib/Transforms/Scalar/SampleProfile.cpp index c7232a97764..3e7cf04001f 100644 --- a/llvm/lib/Transforms/Scalar/SampleProfile.cpp +++ b/llvm/lib/Transforms/Scalar/SampleProfile.cpp @@ -217,6 +217,9 @@ void SampleProfileLoader::printBlockWeight(raw_ostream &OS, BasicBlock *BB) { /// \returns The profiled weight of I. unsigned SampleProfileLoader::getInstWeight(Instruction &Inst) { DebugLoc DLoc = Inst.getDebugLoc(); + if (DLoc.isUnknown()) + return 0; + unsigned Lineno = DLoc.getLine(); if (Lineno < HeaderLineno) return 0; |