search for: oneelt

Displaying 12 results from an estimated 12 matches for "oneelt".

2014 Aug 20
3
[LLVMdev] Addressing const reference in ArrayRef
Analyzing why GCC failed to build LLVM recently, one root cause lies in definition of ArrayRef: // ArrayRef.h: ArrayRef(const T &OneElt) : Data(&OneElt), Length(1) {} Here address of const reference is taken and stored to an object. It is believed that live range of const reference is only at the function call site, escaping of its address to an object with a longer live range is invalid. Referring to the case and discussion h...
2014 Jul 18
2
[LLVMdev] Bug in llvm/ADT/ArrayRef.h?
...cpp prints: "Expected behaviour." I think (as a quick fix) we should remove the const qualifier from ArrayRef's CTor argument, so that the above code won't compile anymore and thus avoiding a silent failure. To be precise: Change llvm/ADT/ArrayRef.h:57 from ArrayRef(const T &OneElt) : Data(&OneElt), Length(1) {} to ArrayRef(T &OneElt) : Data(&OneElt), Length(1) {} Best regards, Andreas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140718/7ac8f807/attachment.h...
2014 Aug 22
2
[LLVMdev] Addressing const reference in ArrayRef
...> --- a/include/llvm/ADT/ArrayRef.h > +++ b/include/llvm/ADT/ArrayRef.h > @@ -68,7 +68,7 @@ namespace llvm { > /*implicit*/ ArrayRef(NoneType) : Data(nullptr), Length(0) {} > > /// Construct an ArrayRef from a single element. > - /*implicit*/ ArrayRef(const T &OneElt) > + __attribute__((deprecated)) /*implicit*/ ArrayRef(const T &OneElt) > : Data(&OneElt), Length(1) {} > > /// Construct an ArrayRef from a pointer and length. > > and rebuilding LLVM and Clang gives me: > > $ ninja 2>&1 | grep -e Wdeprecated-d...
2014 Aug 21
2
[LLVMdev] Addressing const reference in ArrayRef
...ussion to continue from there. > > On Aug 19, 2014 11:18 PM, "Joey Ye" <joey.ye.cc at gmail.com> wrote: > > Analyzing why GCC failed to build LLVM recently, one root cause lies > in definition of ArrayRef: > // ArrayRef.h: > ArrayRef(const T &OneElt) : Data(&OneElt), Length(1) {} > > Here address of const reference is taken and stored to an object. It > is believed that live range of const reference is only at the function > call site, escaping of its address to an object with a longer live > range is inv...
2014 Aug 22
4
[LLVMdev] Addressing const reference in ArrayRef
...assertions, etc)). Of course that would be thwarted by moving the string into a local variable. Nothing perfect here. > If we remove the `ArrayRef` constructor AND the helper, and add a new > helper like: > > template <class T> ArrayRef<T> makeTempArrayRef(const T &OneElt) { > return ArrayRef<T>(&OneElt, &OneElt + 1); > } > > then both types of bugs will be more rare and obvious. > > For the OP's case, the name "Temp" makes it more clear that the ArrayRef > shouldn't be named. For my case, since the cal...
2014 Aug 21
2
[LLVMdev] Addressing const reference in ArrayRef
...m> wrote: >> >> > >> >> > Analyzing why GCC failed to build LLVM recently, one root cause >> >> > lies >> >> > in definition of ArrayRef: >> >> > // ArrayRef.h: >> >> > ArrayRef(const T &OneElt) : Data(&OneElt), Length(1) {} >> >> > >> >> > Here address of const reference is taken and stored to an object. >> >> > It >> >> > is believed that live range of const reference is only at the >> >> > function &...
2014 Aug 21
2
[LLVMdev] Addressing const reference in ArrayRef
...ug 19, 2014 11:18 PM, "Joey Ye" <joey.ye.cc at gmail.com> wrote: >> > >> > Analyzing why GCC failed to build LLVM recently, one root cause lies >> > in definition of ArrayRef: >> > // ArrayRef.h: >> > ArrayRef(const T &OneElt) : Data(&OneElt), Length(1) {} >> > >> > Here address of const reference is taken and stored to an object. It >> > is believed that live range of const reference is only at the >> > function >> > call site, escaping of its address to an o...
2012 Dec 02
3
[LLVMdev] GetElementPtrInst question
Hi all, How can I create an llvm::GetElementPtrInst in which the pointer and the index are in registers previously loaded with llvm::LoadInst ? I mean, the generated instruction will be like this: %1 = getelementptr i8* %myreg1, i32 %myreg2 here, %myreg1 and %myreg2 are previously created by load instructions (llvm::LoadInst). Please, let me know if there is an example of something similar.
2014 Aug 20
2
[LLVMdev] LLVM CreateStructGEP type assert error
...the context of the prior discussion to continue from there. On Aug 19, 2014 11:18 PM, "Joey Ye" <joey.ye.cc at gmail.com> wrote: > Analyzing why GCC failed to build LLVM recently, one root cause lies > in definition of ArrayRef: > // ArrayRef.h: > ArrayRef(const T &OneElt) : Data(&OneElt), Length(1) {} > > Here address of const reference is taken and stored to an object. It > is believed that live range of const reference is only at the function > call site, escaping of its address to an object with a longer live > range is invalid. Referring to t...
2014 Aug 20
2
[LLVMdev] LLVM CreateStructGEP type assert error
...cussion to continue from there. > On Aug 19, 2014 11:18 PM, "Joey Ye" <joey.ye.cc at gmail.com> wrote: > > > Analyzing why GCC failed to build LLVM recently, one root cause lies > > in definition of ArrayRef: > > // ArrayRef.h: > > ArrayRef(const T &OneElt) : Data(&OneElt), Length(1) {} > > > > Here address of const reference is taken and stored to an object. It > > is believed that live range of const reference is only at the function > > call site, escaping of its address to an object with a longer live > > range i...
2014 Aug 20
2
[LLVMdev] LLVM CreateStructGEP type assert error
.... > > On Aug 19, 2014 11:18 PM, "Joey Ye" <joey.ye.cc at gmail.com> wrote: > > > > > Analyzing why GCC failed to build LLVM recently, one root cause lies > > > in definition of ArrayRef: > > > // ArrayRef.h: > > > ArrayRef(const T &OneElt) : Data(&OneElt), Length(1) {} > > > > > > Here address of const reference is taken and stored to an object. It > > > is believed that live range of const reference is only at the function > > > call site, escaping of its address to an object with a longer li...
2014 Aug 20
2
[LLVMdev] LLVM CreateStructGEP type assert error
...14 11:18 PM, "Joey Ye" <joey.ye.cc at gmail.com> wrote: > > > > > > > Analyzing why GCC failed to build LLVM recently, one root cause lies > > > > in definition of ArrayRef: > > > > // ArrayRef.h: > > > > ArrayRef(const T &OneElt) : Data(&OneElt), Length(1) {} > > > > > > > > Here address of const reference is taken and stored to an object. It > > > > is believed that live range of const reference is only at the function > > > > call site, escaping of its address to an obj...