[LLVMdev] LongTy in LowerInvoke.cpp

Chris Lattner sabre at nondot.org
Thu May 12 23:12:45 PDT 2005


On Fri, 13 May 2005, Markus F.X.J. Oberhumer wrote:
>> Ah ok, in that case, the CBE should be fixed.  There are other cases that 
>> could cause long arguments to exist on 32-bit systems.  If the C compiler 
>> takes issue with this, it would be best to tell the CBE to emit casts to C 
>> (long) or something.
>
> Actually that's the only case I stumbled over this problem in a somewhat 
> larger C++ program, and it's clearly the wrong type in LowerInvoke.cpp - it 
> really should be IntPtrTy. But maybe we could use just IntTy here to avoid 
> target dependencies.

Note that this is perfectly legal llvm code and the CBE should work on it. 
The reason this doesn't show up often is because the instcombine pass 
shrinks longs to ints on 32-bit targets.  This is a property of the 
optimizer though, and the CBE should work on all valid llvm code.  That 
said, I assume you're just getting compiler warnings, not errors?  If so, 
it's not that big of a deal.  I'll fixed LowerInvoke.cpp in any case.

-Chris

>>>>> Index: LowerInvoke.cpp
>>>>> ===================================================================
>>>>> RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/LowerInvoke.cpp,v
>>>>> retrieving revision 1.23
>>>>> diff -r1.23 LowerInvoke.cpp
>>>>> 160c160
>>>>> <     std::vector<Constant*> GEPIdx(2, 
>>>>> Constant::getNullValue(Type::LongTy));
>>>>> ---
>>>>> 
>>>>>>     std::vector<Constant*> GEPIdx(2, 
>>>>> 
>>>>> 
>>>>> Constant::getNullValue(XXX::IntPtrTy));
>>>>> 173c173
>>>>> <     std::vector<Constant*> GEPIdx(2, 
>>>>> Constant::getNullValue(Type::LongTy));
>>>>> ---
>>>>> 
>>>>>>     std::vector<Constant*> GEPIdx(2, 
>>>>> 
>>>>> 
>>>>> Constant::getNullValue(XXX::IntPtrTy));
>>>>> 
>>>>> 
>>>> 
>>>> -Chris
>>>> 
>>> 
>>> 
>>> 
>> 
>> -Chris
>> 
>
>
>

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-dev mailing list