[llvm] r232792 - SampleProfile: Check for missing debug locations

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu Mar 19 17:56:55 PDT 2015


Author: dexonsmith
Date: Thu Mar 19 19:56:55 2015
New Revision: 232792

URL: http://llvm.org/viewvc/llvm-project?rev=232792&view=rev
Log:
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).

Modified:
    llvm/trunk/lib/Transforms/Scalar/SampleProfile.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/SampleProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SampleProfile.cpp?rev=232792&r1=232791&r2=232792&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SampleProfile.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SampleProfile.cpp Thu Mar 19 19:56:55 2015
@@ -217,6 +217,9 @@ void SampleProfileLoader::printBlockWeig
 /// \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;





More information about the llvm-commits mailing list