[llvm-commits] [llvm] r51157 - in /llvm/trunk: include/llvm/Constants.h include/llvm/Instruction.def include/llvm/Instructions.h include/llvm/Support/InstVisitor.h lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.h.cvs lib/AsmParser/llvmAsmParser.y lib/AsmParser/llvmAsmParser.y.cvs lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/VMCore/ConstantFold.cpp lib/VMCore/ConstantFold.h lib/VMCore/Constants.cpp lib/VMCore/Instructions.cpp lib/VMCore/Verifier.cpp test/Verifier/2002-11-05-GetelementptrPointers.ll

Chris Lattner clattner at apple.com
Fri May 16 21:09:06 PDT 2008


On May 16, 2008, at 12:39 PM, Duncan Sands wrote:

> Hi Dan,
>
>>> Do you want to allow this on VectorType?  ...
>>
>> I don't know yet. It turns out that getelementptr works on vector  
>> types,
>> and that made me think having extractelement/insertelement support  
>> them
>> as well. It would make the IR more concise, because a single
>> extractevalue
>> could be used where otherwise an extractvalue followed by an
>> extractelement
>> would be needed. But it also means instcombine would have to do for
>> extractvalue/insertvalue what it does for extractelement/ 
>> insertelement.
>> And there's no advantage for codegen.
>
> it would be nice to get rid of VectorType and just use ArrayType.   
> What
> used to be VectorType would just mean an ArrayType where the element  
> type
> is an integer or floating point type (so operations like adding  
> vectors
> make sense), and for these component-wise operations like addition  
> would
> allowed.  At codegen time, some ArrayType's would be lowered at once  
> to
> components (those which can't possibly benefit from machine vector
> operations, such as arrays where the element type is neither integer  
> nor
> floating point), while the rest can be legalized like VectorType is  
> now.

I asked dan to not eliminate vector type for now.  Allowing arrays to  
act like vectors means defining addition (etc) over array types.  This  
may be an interesting change to do after basic first-class-agg support  
lands, but not at the same time.

> One problem with this scheme is that vector extractelement/ 
> insertelement
> can take a non-constant index.  Is that actually useful?  If not, they
> could be eliminated in favor of extractvalue/insertvalue.  Otherwise  
> an
> idea is needed to simplify this aspect :)

Currently extractelement and extractvalue are different this way.

-Chris



More information about the llvm-commits mailing list