[llvm-commits] [llvm] r105279 - /llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
Jim Grosbach
grosbach at apple.com
Tue Jun 1 14:09:03 PDT 2010
Quite right. Done in r105289.
-Jim
On Jun 1, 2010, at 12:56 PM, Chris Lattner wrote:
> On Jun 1, 2010, at 10:56 AM, Jim Grosbach wrote:
>> URL: http://llvm.org/viewvc/llvm-project?rev=105279&view=rev
>> Log:
>> Use SmallVector instead of std::vector.
>
> One tweak:
>
>> @@ -95,7 +96,7 @@
>> void createAbortMessage(Module *M);
>> void writeAbortMessage(Instruction *IB);
>> bool insertCheapEHSupport(Function &F);
>> - void splitLiveRangesLiveAcrossInvokes(std::vector<InvokeInst*> &Invokes);
>> + void splitLiveRangesLiveAcrossInvokes(SmallVector<InvokeInst*,16> &Invokes);
>> void rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo,
>> AllocaInst *InvokeNum, AllocaInst *StackPtr,
>> SwitchInst *CatchSwitch);
>
> For arguments, you can declare functions as taking "SmallVectorImpl<InvokeInst*> &", which avoids coding the small vector size into the argument list.
>
> -Chris
>
>> @@ -196,7 +197,7 @@
>> GlobalVariable *MsgGV = new GlobalVariable(*M, Msg->getType(), true,
>> GlobalValue::InternalLinkage,
>> Msg, "abortmsg");
>> - std::vector<Constant*> GEPIdx(2,
>> + SmallVector<Constant*,2> GEPIdx(2,
>> Constant::getNullValue(Type::getInt32Ty(M->getContext())));
>> AbortMessage = ConstantExpr::getGetElementPtr(MsgGV, &GEPIdx[0], 2);
>
> This looks like it should just use a 2-element C array.
>
>> } else {
>> @@ -211,7 +212,7 @@
>> GlobalVariable *MsgGV = new GlobalVariable(*M, Msg->getType(), true,
>> GlobalValue::InternalLinkage,
>> Msg, "abortmsg");
>> - std::vector<Constant*> GEPIdx(2, Constant::getNullValue(
>> + SmallVector<Constant*,2> GEPIdx(2, Constant::getNullValue(
>> Type::getInt32Ty(M->getContext())));
>> AbortMessage = ConstantExpr::getGetElementPtr(MsgGV, &GEPIdx[0], 2);
>> }
> ...
>> new AllocaInst(JBLinkTy, 0, Align,
>> "jblink", F.begin()->begin());
>>
>> - std::vector<Value*> Idx;
>> + SmallVector<Value*,2> Idx;
>> Idx.push_back(Constant::getNullValue(Type::getInt32Ty(F.getContext())));
>> Idx.push_back(ConstantInt::get(Type::getInt32Ty(F.getContext()), 1));
>> OldJmpBufPtr = GetElementPtrInst::Create(JmpBuf, Idx.begin(), Idx.end(),
>> @@ -605,7 +606,7 @@
>>
>> // Create the block to do the longjmp.
>> // Get a pointer to the jmpbuf and longjmp.
>> - std::vector<Value*> Idx;
>> + SmallVector<Value*,2> Idx;
>> Idx.push_back(Constant::getNullValue(Type::getInt32Ty(F.getContext())));
>> Idx.push_back(ConstantInt::get(Type::getInt32Ty(F.getContext()), 0));
>> Idx[0] = GetElementPtrInst::Create(BufPtr, Idx.begin(), Idx.end(), "JmpBuf",
>
> Likewise,
>
> -Chris
More information about the llvm-commits
mailing list