[llvm] r223808 - Reorder the code to avoid inserting at the beginning of a vector.

Frederic Riss friss at apple.com
Tue Dec 9 10:57:35 PST 2014


Author: friss
Date: Tue Dec  9 12:57:34 2014
New Revision: 223808

URL: http://llvm.org/viewvc/llvm-project?rev=223808&view=rev
Log:
Reorder the code to avoid inserting at the beginning of a vector.

As per dblaikie suggestion, thanks\!

Modified:
    llvm/trunk/lib/Transforms/Utils/Local.cpp

Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=223808&r1=223807&r2=223808&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Tue Dec  9 12:57:34 2014
@@ -1120,12 +1120,12 @@ bool llvm::replaceDbgDeclareForAlloca(Al
   // will take a value storing address of the memory for variable, not
   // alloca itself.
   SmallVector<int64_t, 4> NewDIExpr;
+  NewDIExpr.push_back(dwarf::DW_OP_deref);
   if (DIExpr) {
     for (unsigned i = 0, n = DIExpr.getNumElements(); i < n; ++i) {
       NewDIExpr.push_back(DIExpr.getElement(i));
     }
   }
-  NewDIExpr.insert(NewDIExpr.begin(), dwarf::DW_OP_deref);
 
   // Insert llvm.dbg.declare in the same basic block as the original alloca,
   // and remove old llvm.dbg.declare.





More information about the llvm-commits mailing list