[llvm] r176602 - Switch from std::vector to ArrayRef. Speedup FoldBitCast by 5x.

Nadav Rotem nrotem at apple.com
Wed Mar 6 17:30:40 PST 2013


Author: nadav
Date: Wed Mar  6 19:30:40 2013
New Revision: 176602

URL: http://llvm.org/viewvc/llvm-project?rev=176602&view=rev
Log:
Switch from std::vector to ArrayRef. Speedup FoldBitCast by 5x.

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

Modified: llvm/trunk/lib/IR/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Constants.cpp?rev=176602&r1=176601&r2=176602&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Constants.cpp (original)
+++ llvm/trunk/lib/IR/Constants.cpp Wed Mar  6 19:30:40 2013
@@ -1416,9 +1416,9 @@ static inline Constant *getFoldedCast(
 
   LLVMContextImpl *pImpl = Ty->getContext().pImpl;
 
-  // Look up the constant in the table first to ensure uniqueness
-  std::vector<Constant*> argVec(1, C);
-  ExprMapKeyType Key(opc, argVec);
+  // Look up the constant in the table first to ensure uniqueness.
+  ArrayRef<Constant*> Ops(&C, 1);
+  ExprMapKeyType Key(opc, Ops);
 
   return pImpl->ExprConstants.getOrCreate(Ty, Key);
 }





More information about the llvm-commits mailing list