[llvm] r211204 - Simply test for available locations in optimization remarks.

Diego Novillo dnovillo at google.com
Wed Jun 18 11:46:58 PDT 2014


Author: dnovillo
Date: Wed Jun 18 13:46:58 2014
New Revision: 211204

URL: http://llvm.org/viewvc/llvm-project?rev=211204&view=rev
Log:
Simply test for available locations in optimization remarks.

When emitting optimization remarks, we test for the presence of
instruction locations by testing for a valid llvm.dbg.cu annotation.
This is slightly inefficient because we can simply ask whether the
debug location we have is known or not.

Additionally, if my current plan works, I will need to remove the
llvm.dbg.cu annotation from the IL (or prevent it from being generated)
when -Rpass is used without -g.  In those cases, we'll want to generate
line tables but we will want to prevent code generation from emitting
DWARF code for them.

Tested on x86_64.

Modified:
    llvm/trunk/lib/IR/DiagnosticInfo.cpp

Modified: llvm/trunk/lib/IR/DiagnosticInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DiagnosticInfo.cpp?rev=211204&r1=211203&r2=211204&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DiagnosticInfo.cpp (original)
+++ llvm/trunk/lib/IR/DiagnosticInfo.cpp Wed Jun 18 13:46:58 2014
@@ -128,7 +128,7 @@ void DiagnosticInfoSampleProfile::print(
 }
 
 bool DiagnosticInfoOptimizationRemarkBase::isLocationAvailable() const {
-  return getFunction().getParent()->getNamedMetadata("llvm.dbg.cu") != nullptr;
+  return getDebugLoc().isUnknown() == false;
 }
 
 void DiagnosticInfoOptimizationRemarkBase::getLocation(StringRef *Filename,





More information about the llvm-commits mailing list