[llvm] r211353 - Reverting size_type for the containers from size_type to unsigned.

Yaron Keren yaron.keren at gmail.com
Fri Jun 20 06:09:23 PDT 2014


Ok, the code depends on SmallBitVector::size() being size_t, I reverted it
in revision 211356.

This should be more throughly reviewed, as SmallBitVector::count() was and
still is unsigned which does not make sense: size() and count() count the
same items and should be same datatype.

Yaron



2014-06-20 15:47 GMT+03:00 Eli Bendersky <eliben at google.com>:

> Yes fully synced to r211353
>
> llvm_svn_rw/lib/Transforms/Scalar/LoopStrengthReduce.cpp:195:66: note:
> mismatched types 'std::initializer_list<_Tp>' and 'unsigned int'
>      UsedByIndices.resize(std::min(UsedByIndices.size(), LastLUIdx));
>
> etc.
>


On Fri, Jun 20, 2014 at 5:45 AM, Yaron Keren <yaron.keren at gmail.com> wrote:

> Hi Eli,
>
> Is it after this revision? size_type == unsigned?
>
> What is the error message? I did not get (yet) from the builder.
>
> Yaron
>
>
>
> 2014-06-20 15:42 GMT+03:00 Eli Bendersky <eliben at google.com>:
>
> It still doesn't compile on x64 Ubuntu
>
>
>
> On Fri, Jun 20, 2014 at 5:20 AM, Yaron Keren <yaron.keren at gmail.com>
> wrote:
>
>> Author: yrnkrn
>> Date: Fri Jun 20 07:20:56 2014
>> New Revision: 211353
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=211353&view=rev
>> Log:
>> Reverting size_type for the containers from size_type to unsigned.
>> Various places in LLVM assume that container size and count are unsigned
>> and do not use the container size_type. Therefore they break compilation
>> (or possibly executation) for LP64 systems where size_t is 64 bit while
>> unsigned is still 32 bit.
>>
>> If we'll ever that many items in the container size_type could be made
>> size_t for a specific containers after reviweing its other uses.
>>
>>
>> Modified:
>>     llvm/trunk/include/llvm/ADT/DenseMap.h
>>     llvm/trunk/include/llvm/ADT/DenseSet.h
>>     llvm/trunk/include/llvm/ADT/ScopedHashTable.h
>>     llvm/trunk/include/llvm/ADT/SmallBitVector.h
>>     llvm/trunk/include/llvm/ADT/SmallPtrSet.h
>>     llvm/trunk/include/llvm/ADT/SparseBitVector.h
>>     llvm/trunk/include/llvm/ADT/SparseMultiSet.h
>>     llvm/trunk/include/llvm/ADT/SparseSet.h
>>     llvm/trunk/include/llvm/IR/ValueMap.h
>>
>> Modified: llvm/trunk/include/llvm/ADT/DenseMap.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=211353&r1=211352&r2=211353&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/DenseMap.h (original)
>> +++ llvm/trunk/include/llvm/ADT/DenseMap.h Fri Jun 20 07:20:56 2014
>> @@ -43,7 +43,7 @@ protected:
>>    typedef std::pair<KeyT, ValueT> BucketT;
>>
>>  public:
>> -  typedef size_t size_type;
>> +  typedef unsigned size_type;
>>    typedef KeyT key_type;
>>    typedef ValueT mapped_type;
>>    typedef BucketT value_type;
>>
>> Modified: llvm/trunk/include/llvm/ADT/DenseSet.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseSet.h?rev=211353&r1=211352&r2=211353&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/DenseSet.h (original)
>> +++ llvm/trunk/include/llvm/ADT/DenseSet.h Fri Jun 20 07:20:56 2014
>> @@ -29,7 +29,7 @@ class DenseSet {
>>  public:
>>    typedef ValueT key_type;
>>    typedef ValueT value_type;
>> -  typedef size_t size_type;
>> +  typedef unsigned size_type;
>>
>>    explicit DenseSet(unsigned NumInitBuckets = 0) :
>> TheMap(NumInitBuckets) {}
>>
>>
>> Modified: llvm/trunk/include/llvm/ADT/ScopedHashTable.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ScopedHashTable.h?rev=211353&r1=211352&r2=211353&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/ScopedHashTable.h (original)
>> +++ llvm/trunk/include/llvm/ADT/ScopedHashTable.h Fri Jun 20 07:20:56 2014
>> @@ -148,7 +148,7 @@ public:
>>    /// ScopeTy - This is a helpful typedef that allows clients to get
>> easy access
>>    /// to the name of the scope for this hash table.
>>    typedef ScopedHashTableScope<K, V, KInfo, AllocatorTy> ScopeTy;
>> -  typedef size_t size_type;
>> +  typedef unsigned size_type;
>>  private:
>>    typedef ScopedHashTableVal<K, V> ValTy;
>>    DenseMap<K, ValTy*, KInfo> TopLevelMap;
>>
>> Modified: llvm/trunk/include/llvm/ADT/SmallBitVector.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallBitVector.h?rev=211353&r1=211352&r2=211353&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/SmallBitVector.h (original)
>> +++ llvm/trunk/include/llvm/ADT/SmallBitVector.h Fri Jun 20 07:20:56 2014
>> @@ -54,7 +54,7 @@ class SmallBitVector {
>>    };
>>
>>  public:
>> -  typedef size_t size_type;
>> +  typedef unsigned size_type;
>>    // Encapsulation of a single bit.
>>    class reference {
>>      SmallBitVector &TheVector;
>>
>> Modified: llvm/trunk/include/llvm/ADT/SmallPtrSet.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallPtrSet.h?rev=211353&r1=211352&r2=211353&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/SmallPtrSet.h (original)
>> +++ llvm/trunk/include/llvm/ADT/SmallPtrSet.h Fri Jun 20 07:20:56 2014
>> @@ -73,7 +73,7 @@ protected:
>>    ~SmallPtrSetImplBase();
>>
>>  public:
>> -  typedef size_t size_type;
>> +  typedef unsigned size_type;
>>    bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { return size() == 0; }
>>    size_type size() const { return NumElements; }
>>
>>
>> Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=211353&r1=211352&r2=211353&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original)
>> +++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Fri Jun 20 07:20:56 2014
>> @@ -45,7 +45,7 @@ struct SparseBitVectorElement
>>    : public ilist_node<SparseBitVectorElement<ElementSize> > {
>>  public:
>>    typedef unsigned long BitWord;
>> -  typedef size_t size_type;
>> +  typedef unsigned size_type;
>>    enum {
>>      BITWORD_SIZE = sizeof(BitWord) * CHAR_BIT,
>>      BITWORDS_PER_ELEMENT = (ElementSize + BITWORD_SIZE - 1) /
>> BITWORD_SIZE,
>>
>> Modified: llvm/trunk/include/llvm/ADT/SparseMultiSet.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseMultiSet.h?rev=211353&r1=211352&r2=211353&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/SparseMultiSet.h (original)
>> +++ llvm/trunk/include/llvm/ADT/SparseMultiSet.h Fri Jun 20 07:20:56 2014
>> @@ -185,7 +185,7 @@ public:
>>    typedef const ValueT &const_reference;
>>    typedef ValueT *pointer;
>>    typedef const ValueT *const_pointer;
>> -  typedef size_t size_type;
>> +  typedef unsigned size_type;
>>
>>    SparseMultiSet()
>>      : Sparse(nullptr), Universe(0), FreelistIdx(SMSNode::INVALID),
>> NumFree(0) {}
>>
>> Modified: llvm/trunk/include/llvm/ADT/SparseSet.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseSet.h?rev=211353&r1=211352&r2=211353&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/SparseSet.h (original)
>> +++ llvm/trunk/include/llvm/ADT/SparseSet.h Fri Jun 20 07:20:56 2014
>> @@ -124,7 +124,7 @@ class SparseSet {
>>
>>    typedef typename KeyFunctorT::argument_type KeyT;
>>    typedef SmallVector<ValueT, 8> DenseT;
>> -  typedef size_t size_type;
>> +  typedef unsigned size_type;
>>    DenseT Dense;
>>    SparseT *Sparse;
>>    unsigned Universe;
>>
>> Modified: llvm/trunk/include/llvm/IR/ValueMap.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/ValueMap.h?rev=211353&r1=211352&r2=211353&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/IR/ValueMap.h (original)
>> +++ llvm/trunk/include/llvm/IR/ValueMap.h Fri Jun 20 07:20:56 2014
>> @@ -87,7 +87,7 @@ public:
>>    typedef KeyT key_type;
>>    typedef ValueT mapped_type;
>>    typedef std::pair<KeyT, ValueT> value_type;
>> -  typedef size_t size_type;
>> +  typedef unsigned size_type;
>>
>>    explicit ValueMap(unsigned NumInitBuckets = 64)
>>      : Map(NumInitBuckets), Data() {}
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140620/b61b89a5/attachment.html>


More information about the llvm-commits mailing list