Transforms: Use the new DebugLoc API, NFC
[oota-llvm.git] / lib / Transforms / Scalar / SampleProfile.cpp
index 3e7cf04001f9f05a18c676bd5bb502af0e6d9351..f56e2f1d87c0c04365df447dfa0c84b363a173ab 100644 (file)
@@ -217,14 +217,14 @@ 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())
+  if (!DLoc)
     return 0;
 
   unsigned Lineno = DLoc.getLine();
   if (Lineno < HeaderLineno)
     return 0;
 
-  DILocation DIL(DLoc.getAsMDNode(*Ctx));
+  DILocation DIL = DLoc.get();
   int LOffset = Lineno - HeaderLineno;
   unsigned Discriminator = DIL.getDiscriminator();
   unsigned Weight = Samples->samplesAt(LOffset, Discriminator);