[llvm-commits] [llvm-gcc-4.2] r79597 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Bill Wendling isanbard at gmail.com
Thu Aug 20 23:59:50 PDT 2009


On Aug 20, 2009, at 11:51 PM, Eli Friedman wrote:

> On Thu, Aug 20, 2009 at 11:11 PM, Bill Wendling<isanbard at gmail.com>  
> wrote:
>> --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
>> +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Aug 21 01:11:55 2009
>> @@ -3472,13 +3472,18 @@
>>  Value *TreeToLLVM::EmitRotateOp(tree exp, unsigned Opc1, unsigned  
>> Opc2) {
>>   Value *In  = Emit(TREE_OPERAND(exp, 0), 0);
>>   Value *Amt = Emit(TREE_OPERAND(exp, 1), 0);
>> +
>> +  if (isa<PointerType>(In->getType()))
>> +    In = Builder.CreatePtrToInt(In, Amt->getType(),
>> +                                (In->getNameStr()+".cast").c_str());
>
> Umm, I think you want intptr_t rather than the width of the shift  
> amount...
>
Possibly. Though basically at this point GCC has decided that all of  
the types involved in this charade have the same size. That is when  
we're still seeing a pointer at this point, and not a pointer cast to  
an integral value. (GCC has stripped off that cast, causing us to fail  
to see it.)

I'll go ahead and make the change, though. It'll be the saner thing to  
do. :-)

Actually, I noticed a deficiency in InstCombine. When it goes to  
convert this heresy into a RORL command, it can't see past the cast of  
the pointer and so doesn't do the conversion.

-bw




More information about the llvm-commits mailing list