[llvm-commits] [llvm] r77259 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h include/llvm/Operator.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp test/Assembler/flags-plain.ll test/Assembler/flags.ll

Chris Lattner clattner at apple.com
Tue Jul 28 23:48:11 PDT 2009


On Jul 27, 2009, at 2:53 PM, Dan Gohman wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=77259&view=rev
> Log:
> Add a new keyword 'inbounds' for use with getelementptr. See the
> LangRef.html changes for details.

The langref changes look nice.  The choice of "inbounds" is a little  
strange to me, isn't this flag mostly about wrapping behavior when  
overflow happens?

Will "inbounds" be the default generated by the llvm-gcc/clang front- 
ends?  If so, it would be nice to invert the sense of the bit so it  
doesn't show up in all the .ll files making them really noisy.

> +++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jul 27 16:53:46 2009
> @@ -2039,7 +2039,11 @@
>   case lltok::kw_select: {
>     unsigned Opc = Lex.getUIntVal();
>     SmallVector<Constant*, 16> Elts;
> +    bool InBounds = false;
>     Lex.Lex();
> +    if (Opc == Instruction::GetElementPtr)
> +      if (EatIfPresent(lltok::kw_inbounds))
> +        InBounds = true;

Please use:

   InBounds = EatIfPresent(lltok::kw_inbounds);

> bool LLParser::ParseGetElementPtr(Instruction *&Inst,  
> PerFunctionState &PFS) {
>   Value *Ptr, *Val; LocTy Loc, EltLoc;
> +  bool InBounds = false;
> +
> +  if (EatIfPresent(lltok::kw_inbounds))
> +    InBounds = true;

Likewise.

Thanks Dan,

-Chris




More information about the llvm-commits mailing list