[llvm-commits] [llvm] r105289 - /llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp

Jim Grosbach grosbach at apple.com
Tue Jun 1 14:27:56 PDT 2010


On Jun 1, 2010, at 2:15 PM, Chris Lattner wrote:

> 
> On Jun 1, 2010, at 2:06 PM, Jim Grosbach wrote:
> 
>> Author: grosbach
>> Date: Tue Jun  1 16:06:46 2010
>> New Revision: 105289
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=105289&view=rev
>> Log:
>> Simplify things a bit more. Fix prototype to use SmallVectorImpl and
>> change a few SmallVectors to vanilla C arrays.
> 
> Thanks Jim, one gotcha:
> 
>> -    SmallVector<Constant*,2> GEPIdx(2,
>> -                     Constant::getNullValue(Type::getInt32Ty(M->getContext())));
>> +    Constant *GEPIdx[2] = {
>> +      ConstantInt::get(Type::getInt32Ty(M->getContext()), 2),
>> +      Constant::getNullValue(Type::getInt32Ty(M->getContext())) };
> 
> The old code made two elements with nulls in them, the new code makes a 2, then a null.  Something like this should work:
> 
>  Constant *Null32 = Constant::getNullValue(Type::getInt32Ty(M->getContext()));
>  Constant *GEPIdx[2] = { Null32, Null32 };

Doh! Right you are. What I get for doing the change mechanically rather than looking more closely.

I'm considering nuking that function entirely. The only caller is the function following it, writeAbortMessage, and the body of that function is in a "#if 0" block. It looks like because it breaks under Windows since there's no write() function available there.

> 
>>    AbortMessage = ConstantExpr::getGetElementPtr(MsgGV, &GEPIdx[0], 2);
>>  } else {
>>    // The abort message for cheap EH support tells the user that EH is not
>> @@ -212,8 +213,9 @@
>>    GlobalVariable *MsgGV = new GlobalVariable(*M, Msg->getType(), true,
>>                                               GlobalValue::InternalLinkage,
>>                                               Msg, "abortmsg");
>> -    SmallVector<Constant*,2> GEPIdx(2, Constant::getNullValue(
>> -                                            Type::getInt32Ty(M->getContext())));
>> +    Constant *GEPIdx[2] = {
>> +      ConstantInt::get(Type::getInt32Ty(M->getContext()), 2),
>> +      Constant::getNullValue(Type::getInt32Ty(M->getContext())) };
> 
> Likewise.
> 
> Otherwise, looks great, thanks!
> 
> -Chris





More information about the llvm-commits mailing list