[llvm-commits] [llvm] r56704 - in /llvm/trunk: include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/VMCore/

Eric Christopher echristo at apple.com
Tue Sep 30 11:48:08 PDT 2008


Me too. It's driving llvm-as nuts.

Sent from my iPhone

On Sep 30, 2008, at 11:20 AM, Evan Cheng <evan.cheng at apple.com> wrote:

> I am seeing duplicated nounwind on calls:
>         call void @BlockMoveData(i8* %4, i8* %209, i32 16) nounwind
> nounwind
>
> This appears to be introduced between 56697 and 56711. Can someone
> take a look?
>
> Thanks,
>
> Evan
>
> On Sep 26, 2008, at 3:53 PM, Devang Patel wrote:
>
>> Author: dpatel
>> Date: Fri Sep 26 17:53:05 2008
>> New Revision: 56704
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=56704&view=rev
>> Log:
>> Now Attributes are divided in three groups
>> - return attributes - inreg, zext and sext
>> - parameter attributes
>> - function attributes - nounwind, readonly, readnone, noreturn
>>
>> Return attributes use 0 as the index.
>> Function attributes use ~0U as the index.
>>
>> This patch requires corresponding changes in llvm-gcc and clang.
>>
>> Modified:
>>   llvm/trunk/include/llvm/Attributes.h
>>   llvm/trunk/include/llvm/Function.h
>>   llvm/trunk/include/llvm/Instructions.h
>>   llvm/trunk/lib/AsmParser/llvmAsmParser.y
>>   llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs
>>   llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
>>   llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h
>>   llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp
>>   llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
>>   llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
>>   llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
>>   llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
>>   llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
>>   llvm/trunk/lib/VMCore/AsmWriter.cpp
>>   llvm/trunk/lib/VMCore/Attributes.cpp
>>   llvm/trunk/lib/VMCore/Function.cpp
>>   llvm/trunk/lib/VMCore/Verifier.cpp
>>
>> Modified: llvm/trunk/include/llvm/Attributes.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=56704&r1=56703&r2=56704&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> ===
>> ===================================================================
>> --- llvm/trunk/include/llvm/Attributes.h (original)
>> +++ llvm/trunk/include/llvm/Attributes.h Fri Sep 26 17:53:05 2008
>> @@ -146,10 +146,23 @@
>>  //
>> =
>> =
>> =--------------------------------------------------------------------
>> ===//
>>  // Attribute List Accessors
>>  //
>> =
>> =
>> =--------------------------------------------------------------------
>> ===//
>> -
>> -  /// getAttributes - The attributes for the specified index are
>> -  /// returned.  Attributes for the result are denoted with Idx = 0.
>> -  Attributes getAttributes(unsigned Idx) const;
>> +  /// getParamAttributes - The attributes for the specified index  
>> are
>> +  /// returned.
>> +  Attributes getParamAttributes(unsigned Idx) const {
>> +    assert (Idx && Idx != ~0U && "Invalid parameter index!");
>> +    return getAttributes(Idx);
>> +  }
>> +
>> +  /// getRetAttributes - The attributes for the ret value are
>> +  /// returned.
>> +  Attributes getRetAttributes() const {
>> +    return getAttributes(0);
>> +  }
>> +
>> +  /// getFnAttributes - The function attributes are  returned.
>> +  Attributes getFnAttributes() const {
>> +    return getAttributes(~0);
>> +  }
>>
>>  /// paramHasAttr - Return true if the specified parameter index
>> has the
>>  /// specified attribute set.
>> @@ -204,6 +217,11 @@
>>
>> private:
>>  explicit AttrListPtr(AttributeListImpl *L);
>> +
>> +  /// getAttributes - The attributes for the specified index are
>> +  /// returned.  Attributes for the result are denoted with Idx = 0.
>> +  Attributes getAttributes(unsigned Idx) const;
>> +
>> };
>>
>> } // End llvm namespace
>>
>> Modified: llvm/trunk/include/llvm/Function.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=56704&r1=56703&r2=56704&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> === 
>> ===================================================================
>> --- llvm/trunk/include/llvm/Function.h (original)
>> +++ llvm/trunk/include/llvm/Function.h Fri Sep 26 17:53:05 2008
>> @@ -187,38 +187,38 @@
>>
>>  /// @brief Determine if the function does not access memory.
>>  bool doesNotAccessMemory() const {
>> -    return paramHasAttr(0, Attribute::ReadNone);
>> +    return paramHasAttr(~0, Attribute::ReadNone);
>>  }
>>  void setDoesNotAccessMemory(bool DoesNotAccessMemory = true) {
>> -    if (DoesNotAccessMemory) addAttribute(0, Attribute::ReadNone);
>> -    else removeAttribute(0, Attribute::ReadNone);
>> +    if (DoesNotAccessMemory) addAttribute(~0, Attribute::ReadNone);
>> +    else removeAttribute(~0, Attribute::ReadNone);
>>  }
>>
>>  /// @brief Determine if the function does not access or only reads
>> memory.
>>  bool onlyReadsMemory() const {
>> -    return doesNotAccessMemory() || paramHasAttr(0,
>> Attribute::ReadOnly);
>> +    return doesNotAccessMemory() || paramHasAttr(~0,
>> Attribute::ReadOnly);
>>  }
>>  void setOnlyReadsMemory(bool OnlyReadsMemory = true) {
>> -    if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly);
>> -    else removeAttribute(0, Attribute::ReadOnly |
>> Attribute::ReadNone);
>> +    if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly);
>> +    else removeAttribute(~0, Attribute::ReadOnly |
>> Attribute::ReadNone);
>>  }
>>
>>  /// @brief Determine if the function cannot return.
>>  bool doesNotReturn() const {
>> -    return paramHasAttr(0, Attribute::NoReturn);
>> +    return paramHasAttr(~0, Attribute::NoReturn);
>>  }
>>  void setDoesNotReturn(bool DoesNotReturn = true) {
>> -    if (DoesNotReturn) addAttribute(0, Attribute::NoReturn);
>> -    else removeAttribute(0, Attribute::NoReturn);
>> +    if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn);
>> +    else removeAttribute(~0, Attribute::NoReturn);
>>  }
>>
>>  /// @brief Determine if the function cannot unwind.
>>  bool doesNotThrow() const {
>> -    return paramHasAttr(0, Attribute::NoUnwind);
>> +    return paramHasAttr(~0, Attribute::NoUnwind);
>>  }
>>  void setDoesNotThrow(bool DoesNotThrow = true) {
>> -    if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind);
>> -    else removeAttribute(0, Attribute::NoUnwind);
>> +    if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind);
>> +    else removeAttribute(~0, Attribute::NoUnwind);
>>  }
>>
>>  /// @brief Determine if the function returns a structure through
>> first
>>
>> Modified: llvm/trunk/include/llvm/Instructions.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=56704&r1=56703&r2=56704&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> === 
>> ===================================================================
>> --- llvm/trunk/include/llvm/Instructions.h (original)
>> +++ llvm/trunk/include/llvm/Instructions.h Fri Sep 26 17:53:05 2008
>> @@ -1097,38 +1097,38 @@
>>
>>  /// @brief Determine if the call does not access memory.
>>  bool doesNotAccessMemory() const {
>> -    return paramHasAttr(0, Attribute::ReadNone);
>> +    return paramHasAttr(~0, Attribute::ReadNone);
>>  }
>>  void setDoesNotAccessMemory(bool NotAccessMemory = true) {
>> -    if (NotAccessMemory) addAttribute(0, Attribute::ReadNone);
>> -    else removeAttribute(0, Attribute::ReadNone);
>> +    if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone);
>> +    else removeAttribute(~0, Attribute::ReadNone);
>>  }
>>
>>  /// @brief Determine if the call does not access or only reads
>> memory.
>>  bool onlyReadsMemory() const {
>> -    return doesNotAccessMemory() || paramHasAttr(0,
>> Attribute::ReadOnly);
>> +    return doesNotAccessMemory() || paramHasAttr(~0,
>> Attribute::ReadOnly);
>>  }
>>  void setOnlyReadsMemory(bool OnlyReadsMemory = true) {
>> -    if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly);
>> -    else removeAttribute(0, Attribute::ReadOnly |
>> Attribute::ReadNone);
>> +    if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly);
>> +    else removeAttribute(~0, Attribute::ReadOnly |
>> Attribute::ReadNone);
>>  }
>>
>>  /// @brief Determine if the call cannot return.
>>  bool doesNotReturn() const {
>> -    return paramHasAttr(0, Attribute::NoReturn);
>> +    return paramHasAttr(~0, Attribute::NoReturn);
>>  }
>>  void setDoesNotReturn(bool DoesNotReturn = true) {
>> -    if (DoesNotReturn) addAttribute(0, Attribute::NoReturn);
>> -    else removeAttribute(0, Attribute::NoReturn);
>> +    if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn);
>> +    else removeAttribute(~0, Attribute::NoReturn);
>>  }
>>
>>  /// @brief Determine if the call cannot unwind.
>>  bool doesNotThrow() const {
>> -    return paramHasAttr(0, Attribute::NoUnwind);
>> +    return paramHasAttr(~0, Attribute::NoUnwind);
>>  }
>>  void setDoesNotThrow(bool DoesNotThrow = true) {
>> -    if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind);
>> -    else removeAttribute(0, Attribute::NoUnwind);
>> +    if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind);
>> +    else removeAttribute(~0, Attribute::NoUnwind);
>>  }
>>
>>  /// @brief Determine if the call returns a structure through first
>> @@ -2459,35 +2459,35 @@
>>    return paramHasAttr(0, Attribute::ReadNone);
>>  }
>>  void setDoesNotAccessMemory(bool NotAccessMemory = true) {
>> -    if (NotAccessMemory) addAttribute(0, Attribute::ReadNone);
>> -    else removeAttribute(0, Attribute::ReadNone);
>> +    if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone);
>> +    else removeAttribute(~0, Attribute::ReadNone);
>>  }
>>
>>  /// @brief Determine if the call does not access or only reads
>> memory.
>>  bool onlyReadsMemory() const {
>> -    return doesNotAccessMemory() || paramHasAttr(0,
>> Attribute::ReadOnly);
>> +    return doesNotAccessMemory() || paramHasAttr(~0,
>> Attribute::ReadOnly);
>>  }
>>  void setOnlyReadsMemory(bool OnlyReadsMemory = true) {
>> -    if (OnlyReadsMemory) addAttribute(0, Attribute::ReadOnly);
>> -    else removeAttribute(0, Attribute::ReadOnly |
>> Attribute::ReadNone);
>> +    if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly);
>> +    else removeAttribute(~0, Attribute::ReadOnly |
>> Attribute::ReadNone);
>>  }
>>
>>  /// @brief Determine if the call cannot return.
>>  bool doesNotReturn() const {
>> -    return paramHasAttr(0, Attribute::NoReturn);
>> +    return paramHasAttr(~0, Attribute::NoReturn);
>>  }
>>  void setDoesNotReturn(bool DoesNotReturn = true) {
>> -    if (DoesNotReturn) addAttribute(0, Attribute::NoReturn);
>> -    else removeAttribute(0, Attribute::NoReturn);
>> +    if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn);
>> +    else removeAttribute(~0, Attribute::NoReturn);
>>  }
>>
>>  /// @brief Determine if the call cannot unwind.
>>  bool doesNotThrow() const {
>> -    return paramHasAttr(0, Attribute::NoUnwind);
>> +    return paramHasAttr(~0, Attribute::NoUnwind);
>>  }
>>  void setDoesNotThrow(bool DoesNotThrow = true) {
>> -    if (DoesNotThrow) addAttribute(0, Attribute::NoUnwind);
>> -    else removeAttribute(0, Attribute::NoUnwind);
>> +    if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind);
>> +    else removeAttribute(~0, Attribute::NoUnwind);
>>  }
>>
>>  /// @brief Determine if the call returns a structure through first
>>
>> Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=56704&r1=56703&r2=56704&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> === 
>> ===================================================================
>> --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original)
>> +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Fri Sep 26 17:53:05 2008
>> @@ -2346,8 +2346,25 @@
>>
>>  std::vector<const Type*> ParamTypeList;
>>  SmallVector<AttributeWithIndex, 8> Attrs;
>> -  if ($7 != Attribute::None)
>> -    Attrs.push_back(AttributeWithIndex::get(0, $7));
>> +  //FIXME : In 3.0, stop accepting zext, sext and inreg as optional
>> function
>> +  //attributes.
>> +  Attributes RetAttrs = 0;
>> +  if ($7 != Attribute::None) {
>> +    if ($7 & Attribute::ZExt) {
>> +      RetAttrs = RetAttrs | Attribute::ZExt;
>> +      $7 = $7 ^ Attribute::ZExt;
>> +    }
>> +    if ($7 & Attribute::SExt) {
>> +      RetAttrs = RetAttrs | Attribute::SExt;
>> +      $7 = $7 ^ Attribute::SExt;
>> +    }
>> +    if ($7 & Attribute::InReg) {
>> +      RetAttrs = RetAttrs | Attribute::InReg;
>> +      $7 = $7 ^ Attribute::InReg;
>> +    }
>> +    if (RetAttrs != Attribute::None)
>> +      Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
>> +  }
>>  if ($5) {   // If there are arguments...
>>    unsigned index = 1;
>>    for (ArgListType::iterator I = $5->begin(); I != $5->end(); ++I,
>> ++index) {
>> @@ -2359,6 +2376,8 @@
>>        Attrs.push_back(AttributeWithIndex::get(index, I->Attrs));
>>    }
>>  }
>> +  if ($7 != Attribute::None)
>> +    Attrs.push_back(AttributeWithIndex::get(~0, $7));
>>
>>  bool isVarArg = ParamTypeList.size() && ParamTypeList.back() ==
>> Type::VoidTy;
>>  if (isVarArg) ParamTypeList.pop_back();
>> @@ -2860,9 +2879,26 @@
>>    CHECK_FOR_ERROR
>>
>>    SmallVector<AttributeWithIndex, 8> Attrs;
>> -    if ($8 != Attribute::None)
>> -      Attrs.push_back(AttributeWithIndex::get(0, $8));
>> -
>> +    //FIXME : In 3.0, stop accepting zext, sext and inreg as
>> optional function
>> +    //attributes.
>> +    Attributes RetAttrs = 0;
>> +    if ($8 != Attribute::None) {
>> +      if ($8 & Attribute::ZExt) {
>> +        RetAttrs = RetAttrs | Attribute::ZExt;
>> +        $8 = $8 ^ Attribute::ZExt;
>> +      }
>> +      if ($8 & Attribute::SExt) {
>> +        RetAttrs = RetAttrs | Attribute::SExt;
>> +        $8 = $8 ^ Attribute::SExt;
>> +      }
>> +      if ($8 & Attribute::InReg) {
>> +        RetAttrs = RetAttrs | Attribute::InReg;
>> +        $8 = $8 ^ Attribute::InReg;
>> +      }
>> +      if (RetAttrs != Attribute::None)
>> +        Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
>> +    }
>> +
>>    // Check the arguments
>>    ValueList Args;
>>    if ($6->empty()) {                                   // Has no
>> arguments?
>> @@ -2897,7 +2933,8 @@
>>      } else if (I != E || ArgI != ArgE)
>>        GEN_ERROR("Invalid number of parameters detected");
>>    }
>> -
>> +    if ($8 != Attribute::None)
>> +      Attrs.push_back(AttributeWithIndex::get(~0, $8));
>>    AttrListPtr PAL;
>>    if (!Attrs.empty())
>>      PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
>> @@ -3258,8 +3295,27 @@
>>
>>    // Set up the Attributes for the function
>>    SmallVector<AttributeWithIndex, 8> Attrs;
>> -    if ($8 != Attribute::None)
>> -      Attrs.push_back(AttributeWithIndex::get(0, $8));
>> +    //FIXME : In 3.0, stop accepting zext, sext and inreg as
>> optional function
>> +    //attributes.
>> +    Attributes RetAttrs = 0;
>> +    Attributes TmpAttr = $8;
>> +    if ($8 != Attribute::None) {
>> +      if ($8 & Attribute::ZExt) {
>> +        RetAttrs = RetAttrs | Attribute::ZExt;
>> +        $8 = $8 ^ Attribute::ZExt;
>> +      }
>> +      if ($8 & Attribute::SExt) {
>> +        RetAttrs = RetAttrs | Attribute::SExt;
>> +        $8 = $8 ^ Attribute::SExt;
>> +      }
>> +      if ($8 & Attribute::InReg) {
>> +        RetAttrs = RetAttrs | Attribute::InReg;
>> +        $8 = $8 ^ Attribute::InReg;
>> +      }
>> +      if (RetAttrs != Attribute::None)
>> +        Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
>> +    }
>> +
>>    // Check the arguments
>>    ValueList Args;
>>    if ($6->empty()) {                                   // Has no
>> arguments?
>> @@ -3293,6 +3349,8 @@
>>      } else if (I != E || ArgI != ArgE)
>>        GEN_ERROR("Invalid number of parameters detected");
>>    }
>> +    if ($8 != Attribute::None)
>> +      Attrs.push_back(AttributeWithIndex::get(~0, $8));
>>
>>    // Finish off the Attributes and check them
>>    AttrListPtr PAL;
>>
>> Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=56704&r1=56703&r2=56704&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> === 
>> ===================================================================
>> --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original)
>> +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Fri Sep 26 17:53:05
>> 2008
>> @@ -2346,8 +2346,25 @@
>>
>>  std::vector



More information about the llvm-commits mailing list