[llvm-commits] [llvm] r173656 - Revert r173646, "Use proper type for the index."

NAKAMURA Takumi geek4civic at gmail.com
Mon Jan 28 01:15:23 PST 2013


Bill,

On msvc, "FunctionIndex = ~0U" in the enum could not be handled
properly with bitwidth extension.
It is fine with "FunctionIndex = ~(uint32_t)0".
(also possible with "~(uint64_t)0". I think you would need more tweaks
in that case.)

http://bb.pgr.jp/builders/cmake-clang-i686-msvc10/builds/1649
http://bb.pgr.jp/builders/clang-3stage-x86_64-linux/builds/850
http://bb.pgr.jp/builders/cmake-clang-i686-mingw32/builds/2513

Please reapply yours with a tweak in FuncionIndex, thank you.

...Takumi

2013/1/28 NAKAMURA Takumi <geek4civic at gmail.com>:
> Author: chapuni
> Date: Sun Jan 27 22:29:01 2013
> New Revision: 173656
>
> URL: http://llvm.org/viewvc/llvm-project?rev=173656&view=rev
> Log:
> Revert r173646, "Use proper type for the index."
>
> Unfortunately, msvc miscompiles it. Investigating.
>
> Modified:
>     llvm/trunk/include/llvm/IR/Attributes.h
>     llvm/trunk/lib/IR/Attributes.cpp
>
> Modified: llvm/trunk/include/llvm/IR/Attributes.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Attributes.h?rev=173656&r1=173655&r2=173656&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/Attributes.h (original)
> +++ llvm/trunk/include/llvm/IR/Attributes.h Sun Jan 27 22:29:01 2013
> @@ -214,7 +214,7 @@ private:
>
>    /// \brief The attributes for the specified index are returned.  Attributes
>    /// for the result are denoted with Idx = 0.
> -  Attribute getAttributes(uint64_t Idx) const;
> +  Attribute getAttributes(unsigned Idx) const;
>
>    /// \brief Add the specified attribute at the specified index to this
>    /// attribute list.  Since attribute lists are immutable, this returns the new
> @@ -297,25 +297,25 @@ public:
>    AttributeSet getFnAttributes() const;
>
>    /// \brief Return the alignment for the specified function parameter.
> -  unsigned getParamAlignment(uint64_t Idx) const;
> +  unsigned getParamAlignment(unsigned Idx) const;
>
>    /// \brief Return true if the attribute exists at the given index.
> -  bool hasAttribute(uint64_t Index, Attribute::AttrKind Kind) const;
> +  bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const;
>
>    /// \brief Return true if attribute exists at the given index.
> -  bool hasAttributes(uint64_t Index) const;
> +  bool hasAttributes(unsigned Index) const;
>
>    /// \brief Returns the alignment field of an attribute as a byte alignment
>    /// value.
> -  unsigned getAlignment(uint64_t Index) const;
> +  unsigned getAlignment(unsigned Index) const;
>
>    /// \brief Get the stack alignment.
> -  unsigned getStackAlignment(uint64_t Index) const;
> +  unsigned getStackAlignment(unsigned Index) const;
>
>    /// \brief Return the attributes at the index as a string.
> -  std::string getAsString(uint64_t Index) const;
> +  std::string getAsString(unsigned Index) const;
>
> -  uint64_t Raw(uint64_t Index) const;
> +  uint64_t Raw(unsigned Index) const;
>
>    /// \brief Return true if the specified attribute is set for at least one
>    /// parameter or for the return value.
>
> Modified: llvm/trunk/lib/IR/Attributes.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Attributes.cpp?rev=173656&r1=173655&r2=173656&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/Attributes.cpp (original)
> +++ llvm/trunk/lib/IR/Attributes.cpp Sun Jan 27 22:29:01 2013
> @@ -710,27 +710,27 @@ AttributeSet AttributeSet::getSlotAttrib
>    return pImpl->getSlotAttributes(Slot);
>  }
>
> -bool AttributeSet::hasAttribute(uint64_t Index, Attribute::AttrKind Kind) const{
> +bool AttributeSet::hasAttribute(unsigned Index, Attribute::AttrKind Kind) const{
>    return getAttributes(Index).hasAttribute(Kind);
>  }
>
> -bool AttributeSet::hasAttributes(uint64_t Index) const {
> +bool AttributeSet::hasAttributes(unsigned Index) const {
>    return getAttributes(Index).hasAttributes();
>  }
>
> -std::string AttributeSet::getAsString(uint64_t Index) const {
> +std::string AttributeSet::getAsString(unsigned Index) const {
>    return getAttributes(Index).getAsString();
>  }
>
> -unsigned AttributeSet::getParamAlignment(uint64_t Idx) const {
> +unsigned AttributeSet::getParamAlignment(unsigned Idx) const {
>    return getAttributes(Idx).getAlignment();
>  }
>
> -unsigned AttributeSet::getStackAlignment(uint64_t Index) const {
> +unsigned AttributeSet::getStackAlignment(unsigned Index) const {
>    return getAttributes(Index).getStackAlignment();
>  }
>
> -uint64_t AttributeSet::Raw(uint64_t Index) const {
> +uint64_t AttributeSet::Raw(unsigned Index) const {
>    // FIXME: Remove this.
>    return pImpl ? pImpl->Raw(Index) : 0;
>  }
> @@ -738,7 +738,7 @@ uint64_t AttributeSet::Raw(uint64_t Inde
>  /// \brief The attributes for the specified index are returned.
>  ///
>  /// FIXME: This shouldn't return 'Attribute'.
> -Attribute AttributeSet::getAttributes(uint64_t Idx) const {
> +Attribute AttributeSet::getAttributes(unsigned Idx) const {
>    if (pImpl == 0) return Attribute();
>
>    // Loop through to find the attribute we want.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list