[LLVMdev] InstCombine Question
    Chris Lattner 
    sabre at nondot.org
       
    Fri Apr  4 15:06:43 PDT 2008
    
    
  
On Fri, 4 Apr 2008, David Greene wrote:
>> So we're loading a vector of pointers and then using getelementptr as
>> basically a reg-reg copy with a cast (I think).  Yes, it's a little weird,
>> but legal  AFAICS.
>>
>> I'm not sure if the above code is really kosher.  It is very strange to see
>> the typing of the extractelement and GEP here.
>
> Actually, there are multiple problems.  The first zero index on the GEP is
> wrong.  I believe that it should be the following:
>
>   %r62 = getelementptr <2 x double>* null, i64 %r61
>
> This is essentially the equivalent of a bitcast, then.
Right.  I guess it would be acceptable to turn into into an inttoptr 
instruction.
> These are problems in our compiler, not LLVM.  But I do want to ask
> about the legality of the revised GEP above.  Is that legal code?  If so,
> instcombine should not be removing it as dead code.
I don't think it's really legal, GEP shouldn't be used that way.
-Chris
-- 
http://nondot.org/sabre/
http://llvm.org/
    
    
More information about the llvm-dev
mailing list