r228492 - CodeGen: Move DebugLocs.

Benjamin Kramer benny.kra at googlemail.com
Sat Feb 7 05:15:55 PST 2015


Author: d0k
Date: Sat Feb  7 07:15:54 2015
New Revision: 228492

URL: http://llvm.org/viewvc/llvm-project?rev=228492&view=rev
Log:
CodeGen: Move DebugLocs.

It's slightly cheaper than copying it, if the DebugLoc points to replaceable
metadata every copy is recorded in a DenseMap, moving reduces the peak size of
that map.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=228492&r1=228491&r2=228492&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Sat Feb  7 07:15:54 2015
@@ -2342,7 +2342,7 @@ void CodeGenFunction::EmitFunctionEpilog
   }
 
   if (!RetDbgLoc.isUnknown())
-    Ret->setDebugLoc(RetDbgLoc);
+    Ret->setDebugLoc(std::move(RetDbgLoc));
 }
 
 static bool isInAllocaArgument(CGCXXABI &ABI, QualType type) {

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=228492&r1=228491&r2=228492&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Sat Feb  7 07:15:54 2015
@@ -93,7 +93,7 @@ ApplyDebugLocation::ApplyDebugLocation(C
   if (CGF.getDebugInfo()) {
     OriginalLocation = CGF.Builder.getCurrentDebugLocation();
     if (!Loc.isUnknown())
-      CGF.Builder.SetCurrentDebugLocation(Loc);
+      CGF.Builder.SetCurrentDebugLocation(std::move(Loc));
   }
 }
 
@@ -101,7 +101,7 @@ ApplyDebugLocation::~ApplyDebugLocation(
   // Query CGF so the location isn't overwritten when location updates are
   // temporarily disabled (for C++ default function arguments)
   if (CGF.getDebugInfo())
-    CGF.Builder.SetCurrentDebugLocation(OriginalLocation);
+    CGF.Builder.SetCurrentDebugLocation(std::move(OriginalLocation));
 }
 
 /// ArtificialLocation - An RAII object that temporarily switches to





More information about the cfe-commits mailing list