OSDN Git Service

Switch from std::vector to ArrayRef. Speedup FoldBitCast by 5x.
authorNadav Rotem <nrotem@apple.com>
Thu, 7 Mar 2013 01:30:40 +0000 (01:30 +0000)
committerNadav Rotem <nrotem@apple.com>
Thu, 7 Mar 2013 01:30:40 +0000 (01:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176602 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/Constants.cpp

index 8093a09..dafca98 100644 (file)
@@ -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);
 }