[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 23 15:15:19 PDT 2008


On May 23, 2008, at 3:08 PM, Dan Gohman wrote:

>>> +  template<typename InputIterator>
>>> +  void init(Value *Agg, InputIterator IdxBegin, InputIterator
>>> IdxEnd,
>>> +            const std::string &Name,
>>> +            // This argument ensures that we have an iterator we  
>>> can
>>> +            // do arithmetic on in constant time
>>> +            std::random_access_iterator_tag) {
>>> +    unsigned NumIdx = static_cast<unsigned>(std::distance(IdxBegin,
>>> IdxEnd));
>>> +
>>> +    if (NumIdx > 0) {
>>
>> I thought the instruction required at least one index?  Likewise in a
>> couple other places.
>
> It doesn't really need to require an index. An extractvalue with
> no indicies is an identity operation.

LangRef claims otherwise.  Unless there is a reason for it, I'd  
recommend banning zero-index versions of these.  We can always choose  
to allow them later if needed.

-Chris



More information about the llvm-commits mailing list