Displaying 20 results from an estimated 57 matches for "constantvector".
2012 Apr 12
0
[LLVMdev] detection of constant diagonal matrix * vector
...* 0 = 0
which is not
ieee compliant but i post it here in case it is interesting for someone.
on my wish list
there is still an option for target independent optimizations to have x
* 0 = 0.
-Jochen
static void getIntVector(Value* value, SmallVector<int, 8>& values)
{
if (llvm::ConstantVector* constantVector =
llvm::dyn_cast<llvm::ConstantVector>(value))
{
// get components
llvm::SmallVector<llvm::Constant*, 8> elements;
constantVector->getVectorElements(elements);
int numElements = int(elements.size());
for (int i = 0; i...
2012 Jan 20
0
[LLVMdev] How to force the creation of arrays with zeroes?
...he
>> current design, but if not it would be great to eliminate this wart.
> Well, I think the main reason it so reduce the size of .ll / .bc when
> all operands are zero.
> If the array / struct is really big then this can save a lot of space.
isn't this an orthogonal issue? A ConstantVector consisting of only zeros
doesn't have to be represented by storing a vast array of zero values, it
could be special cased internally by setting some kind of flag. If done right,
an all zero ConstantVector would then act exactly the same as every other kind
of ConstantVector as far as users of...
2012 Jan 20
2
[LLVMdev] How to force the creation of arrays with zeroes?
> you can't, you can only get a ConstantAggregateZero. This is actually kind of
> annoying, and means that places expecting a ConstantArray have to remember to
> also check for ConstantAggregateZero. Perhaps there's a good reason for the
> current design, but if not it would be great to eliminate this wart.
Well, I think the main reason it so reduce the size of .ll / .bc when
2013 Jul 22
0
[LLVMdev] Inverse of ConstantFP::get and similar functions?
...eter and check that the value is of a constant of the
> appropriate
> type and value (checking for vectors matching the predicate in the
> vector case).
>
> For example:
>
> static bool ConstantFP::isExactlyValue(Value *V, double D);
You can currently do this:
if (const ConstantVector *CV = dyn_cast<ConstantVector>(X))
if (Constant *Splat = CV->getSplatValue())
// Now you know that Splat is a splatted value, so check it for something.
-Hal
>
> would return true is V is ConstantFP, a splat ConstantVector, or a
> ConstantDataVector with the appropri...
2012 Jan 20
2
[LLVMdev] How to force the creation of arrays with zeroes?
...gn, but if not it would be great to eliminate this wart.
>> Well, I think the main reason it so reduce the size of .ll / .bc when
>> all operands are zero.
>> If the array / struct is really big then this can save a lot of space.
>
> isn't this an orthogonal issue? A ConstantVector consisting of only zeros
> doesn't have to be represented by storing a vast array of zero values, it
> could be special cased internally by setting some kind of flag. If done right,
> an all zero ConstantVector would then act exactly the same as every other kind
> of ConstantVector...
2013 Jul 22
6
[LLVMdev] Inverse of ConstantFP::get and similar functions?
...hich take a value as a
parameter and check that the value is of a constant of the appropriate
type and value (checking for vectors matching the predicate in the
vector case).
For example:
static bool ConstantFP::isExactlyValue(Value *V, double D);
would return true is V is ConstantFP, a splat ConstantVector, or a
ConstantDataVector with the appropriate type. Similarly,
static bool ConstantFP::isZero(Value *V);
would return true if V is a ConstantFP with zero of either sign, a
ConstantVector or ConstantDataVector with all zeros of either sign, or
a zero initializer...
Anyone have any thoughts, an...
2012 Jan 21
0
[LLVMdev] How to force the creation of arrays with zeroes?
...ld be great to eliminate this wart.
>>> Well, I think the main reason it so reduce the size of .ll / .bc when
>>> all operands are zero.
>>> If the array / struct is really big then this can save a lot of space.
>>
>> isn't this an orthogonal issue? A ConstantVector consisting of only zeros
>> doesn't have to be represented by storing a vast array of zero values, it
>> could be special cased internally by setting some kind of flag. If done right,
>> an all zero ConstantVector would then act exactly the same as every other kind
>> o...
2012 Feb 09
2
[LLVMdev] Your commit 149912 "Remove some dead code and tidy things up"...
...=======================================================
> --- PatternMatch.h (revision 149911)
> +++ PatternMatch.h (revision 149912)
> @@ -98,13 +98,6 @@
> Res = &CI->getValue();
> return true;
> }
> - // FIXME: Remove this.
> - if (ConstantVector *CV = dyn_cast<ConstantVector>(V))
> - if (ConstantInt *CI =
> - dyn_cast_or_null<ConstantInt>(CV->getSplatValue())) {
> - Res = &CI->getValue();
> - return true;
> - }
> if (ConstantDataVector *CV = dyn_cast<ConstantD...
2016 Sep 24
4
RFC: ConstantData should not have use-lists
...t code that looks at the users is wrong. Adding an
assertion should catch a lot of bugs (see r263853 and r263875) and
avoid some expensive walks through uninteresting code.
(The same is not true of Constant, generally. A GlobalValue's use-list
will local to the GlobalValue's Module. Any ConstantVector,
ConstantArray, or ConstantStruct that points at a GlobalValue will also
be local to the same Module. In these cases, we also need RAUW
support.)
Besides catching bugs, removing use-lists from ConstantData will
guarantee that the compiler output *does not* depend on the use-list
order of somethin...
2012 Feb 10
0
[LLVMdev] Your commit 149912 "Remove some dead code and tidy things up"...
...==========================
>> --- PatternMatch.h (revision 149911)
>> +++ PatternMatch.h (revision 149912)
>> @@ -98,13 +98,6 @@
>> Res = &CI->getValue();
>> return true;
>> }
>> - // FIXME: Remove this.
>> - if (ConstantVector *CV = dyn_cast<ConstantVector>(V))
>> - if (ConstantInt *CI =
>> - dyn_cast_or_null<ConstantInt>(CV->getSplatValue())) {
>> - Res = &CI->getValue();
>> - return true;
>> - }
>> if (ConstantDataVector *CV...
2012 Feb 10
1
[LLVMdev] Your commit 149912 "Remove some dead code and tidy things up"...
...;> --- PatternMatch.h (revision 149911)
>>> +++ PatternMatch.h (revision 149912)
>>> @@ -98,13 +98,6 @@
>>> Res =&CI->getValue();
>>> return true;
>>> }
>>> - // FIXME: Remove this.
>>> - if (ConstantVector *CV = dyn_cast<ConstantVector>(V))
>>> - if (ConstantInt *CI =
>>> - dyn_cast_or_null<ConstantInt>(CV->getSplatValue())) {
>>> - Res =&CI->getValue();
>>> - return true;
>>> - }
>>> if...
2012 Jan 18
0
[LLVMdev] Should the Constant* pointer be declared with "const" or not?
Hi all.
I'm working on patch and I'm using unchangable ConstantInt objects. So
everywhere I'm using "const ConstantInt*". But this idea came to
deadlock after I tried to create ConstantVector using my vector<const
ConstantInt*> collection. All because of next form of ConstantVector::get:
// Note: ArrayRef declared with non-constant Constant* object.
Constant *ConstantVector::get(ArrayRef<Constant*> V);
What should I do in this case? Make all my ConstantInt* pointers
non-...
2012 Jan 18
0
[LLVMdev] Fw: Should the Constant* pointer be declared with "const" or not?
...ith
> "const" or not?
>>
>> Hi all.
>> I'm working on patch and I'm using unchangable ConstantInt objects.
> So
>> everywhere I'm using "const ConstantInt*". But this idea
> came to
>> deadlock after I tried to create ConstantVector using my vector<const
>> ConstantInt*> collection. All because of next form of
> ConstantVector::get:
>>
>> // Note: ArrayRef declared with non-constant Constant* object.
>> Constant *ConstantVector::get(ArrayRef<Constant*> V);
>>
>> What s...
2012 Jan 18
0
[LLVMdev] Fw: Should the Constant* pointer be declared with "const" or not?
...quot; or not?
>>>
>>> Hi all.
>>> I'm working on patch and I'm using unchangable ConstantInt
> objects. So
>>> everywhere I'm using "const ConstantInt*". But this
> idea came to
>>> deadlock after I tried to create ConstantVector using my
> vector<const
>>> ConstantInt*> collection. All because of next form of
> ConstantVector::get:
>>>
>>> // Note: ArrayRef declared with non-constant Constant* object.
>>> Constant *ConstantVector::get(ArrayRef<Constant*> V);
&g...
2016 Sep 24
2
RFC: ConstantData should not have use-lists
...ing an
>> assertion should catch a lot of bugs (see r263853 and r263875) and
>> avoid some expensive walks through uninteresting code.
>>
>> (The same is not true of Constant, generally. A GlobalValue's use-list
>> will local to the GlobalValue's Module. Any ConstantVector,
>> ConstantArray, or ConstantStruct that points at a GlobalValue will also
>> be local to the same Module. In these cases, we also need RAUW
>> support.)
>>
>> Besides catching bugs, removing use-lists from ConstantData will
>> guarantee that the compiler outp...
2011 Jul 27
0
[LLVMdev] Proposal for better assertions in LLVM
On Jul 26, 2011, at 9:17 PM, Talin wrote:
> Here's an example of how this would be used: In the constructor for ConstantVector, there's an assert:
>
> assert(C->getType() == T->getElementType() &&
> "Initializer for vector element doesn't match vector element type!");
>
> I would change this to:
>
> ASSERT_STRM(C->getType() == T->getElementType(),
&...
2008 Aug 13
2
[LLVMdev] Cleanup of constant sequence type construction
...st ArrayType *T,
Constant*const* Vals, unsigned NumVals);
static Constant *get(const ArrayType *T, const std::vector<Constant*> &);
static Constant *get(Constant*const* Vals, unsigned NumVals);
static Constant *get(const std::vector<Constant*> &);
}
ConstantVector {
static Constant *get(const VectorType *T,
Constant*const* Vals, unsigned NumVals);
static Constant *get(const VectorType *T, const std::vector<Constant*> &);
static Constant *get(Constant*const* Vals, unsigned NumVals);
static Constant *get(const std::vect...
2011 Feb 01
2
[LLVMdev] Convenience methods in ConstantExpr et al
...venience methods as IRBuilder. (In fact, the
naming convention between IRBuilder and the various Constants.h classes
desperately needs to be reconciled, a point which I am sure everyone is
painfully aware of.)
Another thing I'd like to see is for ConstantArray::get(),
ConstantStruct::get() and ConstantVector::get() to have an overload that
takes an iterator pair like IRBuilder's CreateGEP and CreateCall methods.
Also useful for creating small structs would be overloads for
ConstantStruct::get that took 1-4 arguments, instead of having to create a
vector every time. Even better would be an "end...
2011 Jul 27
5
[LLVMdev] Proposal for better assertions in LLVM
Here's an example of how this would be used: In the constructor for
ConstantVector, there's an assert:
assert(C->getType() == T->getElementType() &&
"Initializer for vector element doesn't match vector element
type!");
I would change this to:
ASSERT_STRM(C->getType() == T->getElementType(),
"Initializer for vector ele...
2010 Mar 15
0
[LLVMdev] [patch] Writing ConstantUnions
...get(Context, &NewOps[0], NewOps.size(),
UserCS->getType()->isPacked());
+ } else if (ConstantUnion *UserCU = dyn_cast<ConstantUnion>(UserC)) {
+ NewC = ConstantUnion::get(UserCU->getType(), NewOps[0]);
} else if (isa<ConstantVector>(UserC)) {
NewC = ConstantVector::get(&NewOps[0], NewOps.size());
} else {
@@ -1015,6 +1017,11 @@
Elts.push_back(ValueList.getConstantFwdRef(Record[i],
STy->getElementType(i)));
V = ConstantStruct::g...