Displaying 20 results from an estimated 20000 matches similar to: "getelementptr inbounds with offset 0"
2019 Feb 25
3
getelementptr inbounds with offset 0
Hi Bruce,
On 25.02.19 13:10, Bruce Hoult wrote:
> LLVM has no idea whether the address computed by GEP is actually
> within a legal object. The "inbounds" keyword is just you, the
> programmer, promising LLVM that you know it's ok and that you don't
> care what happens if it is actually out of bounds.
>
>
2019 Mar 15
2
getelementptr inbounds with offset 0
Hi Johannes,
> From the Lang-Ref statement
>
> "With the inbounds keyword, the result value of the GEP is undefined
> if the address is outside the actual underlying allocated object and
> not the address one-past-the-end."
>
> I'd argue that the actual offset value (here 0) is irrelevant. The GEP
> value is undefined if inbounds is present and the
2019 Mar 26
2
getelementptr inbounds with offset 0
Hi Johannes,
>> So, the thinking here is: LLVM cannot exclude the possibility of an
>> object of size 0 existing at any given address. The pointer returned
>> by "GEPi p 0" then would be one-past-the-end of such a 0-sized object.
>> Thus, "GEPi p 0" is the identitiy function for any p, it will not
>> return poison.
>
> I don't see the
2019 Mar 27
2
getelementptr inbounds with offset 0
Hi Johannes,
> Now that reasoning works from a conceptual standpoint only for
> non-inbounds GEPs, I think. From a practical standpoint my above
> description will probably make sure everything works out just fine (see
> also my rephrased answer down below!). I say this because I think the
> following lang-ref passage makes sure everything, not only memory
> accesses, involving
2019 Apr 10
2
getelementptr inbounds with offset 0
Hi,
>>> I see. Is there a quick answer to the questions why you need inbounds
>>> GEPs in that case? Can't you just use non-inbounds GEPs if you know you
>>> might not have a valid base ptr and "optimize" it to inbounds once that
>>> is proven?
>>
>> You mean on the Rust side? We emit GEPi for field accesses and array indexing.
2015 May 03
2
[LLVMdev] Semantics of an Inbounds GetElementPtr
Hi - I've got a question about what optimizations the "inbounds"
keyword of "getelementptr" allows you to use. In the code below, %five
is loaded from and inbounds offset of either a null pointer or %mem:
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
define i8 @func(i8* %mem) {
%test = icmp eq i8* %mem, null
br i1 %test, label %done, label
2016 Jul 19
4
RFC: inbounds on getelementptr indices for global splitting
Hi all,
I'd like to propose an IR extension that allows the inbounds keyword to be
attached to indices in a getelementptr constantexpr.
By placing the inbounds keyword on an index, any pointer derived from the
getelementptr outside of the bounds of the element referred to by that
index, other than the pointer one past the end of the element, shall be
treated as a poison value.
The main
2015 May 04
2
[LLVMdev] Semantics of an Inbounds GetElementPtr
On Sun, May 3, 2015 at 9:57 PM, David Majnemer <david.majnemer at gmail.com>
wrote:
>
>
> On Sun, May 3, 2015 at 6:26 PM, Nicholas White <n.j.white at gmail.com>
> wrote:
>
>> Hi - I've got a question about what optimizations the "inbounds"
>> keyword of "getelementptr" allows you to use. In the code below, %five
>> is loaded
2014 Jan 29
2
[LLVMdev] getelementptr on static const struct
Hi,
I found a mysterious behavior of LLVM optimizer.
I compiled the following code by clang -emit-llvm -S:
#include <stddef.h>
static const struct t {char t[4]; char s;} p = {{}, 'a'};
char f() {
return ((char*)&p)[offsetof(struct t, s)];
}
then I obtained the following LLVM IR:
%struct.t = type { [4 x i8], i8 }
@p = constant %struct.t { [4 x i8] zeroinitializer, i8 97
2019 Jan 14
7
Reducing the number of ptrtoint/inttoptrs that are generated by LLVM
Hello all,
This is a proposal for reducing # of ptrtoint/inttoptr casts which are not
written by programmers but rather generated by LLVM passes.
Currently the majority of ptrtoint/inttoptr casts are generated by LLVM;
when compiling SPEC 2017 with LLVM r348082 (Dec 2 2018) with -O3,
the output IR contains 22,771 inttoptr instructions. However, when
compiling it with -O0, there are only 1048
2015 May 04
2
[LLVMdev] Semantics of an Inbounds GetElementPtr
On Mon, May 4, 2015 at 9:40 AM, Nicholas White <n.j.white at gmail.com> wrote:
> Thanks - that makes sense. It's interesting that at -O3 the optimizer
> can't reduce the below though - I'll dig into it a bit and see if I
> can make a patch that fixes it:
I'm unsure what you expect to happen below. It's not quite the same testcase.
GVN will PRE the loads, so you
2014 Apr 22
2
[LLVMdev] InstCombine strips the inBounds attribute in GetElementPtr ConstantExpr
I can't upload my program due to confidentiality, but the problem is
obvious.
At lib/Analysis/ConstantFolding.cpp:646
Constant *C = ConstantExpr::getGetElementPtr(Ops[0], NewIdxs);
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
if (Constant *Folded = ConstantFoldConstantExpression(CE, TD, TLI))
C = Folded;
}
The generated ConstantExpr C doesn't inherit the
2016 Apr 23
2
[IndVarSimplify] Narrow IV's are not eliminated resulting in inefficient code
Hi Sanjoy,
Thank you for looking into this!
Yes, your patch does fix my larger test case too. My algorithm gets double
performance improvement with the patch, as the loop now has a smaller
instruction set and succeeds to unroll w/o any extra #pragma's.
I also ran the LLVM tests against the patch. There are 6 new failures:
Analysis/LoopAccessAnalysis/number-of-memchecks.ll
2019 Jan 18
2
Reducing the number of ptrtoint/inttoptrs that are generated by LLVM
Hello Sanjoy,
Yep, combining it with propagateEquality of pointers may raise problem. :\
However I believe propagateEquality should be fixed properly, and adding
psub also suggests a solution for that. :)
It is sound to replace a pointer with another if subtraction of them is 0:
a = malloc()
free(a)
b = malloc() // Assume b == a numerically
if ((psub inbounds a b) == 0) { // a and b are
2020 Feb 18
8
The semantics of nonnull attribute
I think calling the attribute "used" is confusing. I'd suggest the following:
"not_poison": If an argument is marked not_poison, and the argument is poison at runtime, the call is instant UB. Whether an argument is poison is checked after the rules for other attributes like "nonnull" and "align" are applied.
This makes it clear that the IR semantics
2018 Nov 05
3
Safe fptoui/fptosi casts
Hi everyone!
The fptoui/fptosi instructions are currently specified to return a poison
value if the rounded-towards-zero floating point number cannot be
represented by the target integer type. The motivation for this behavior is
that overflowing float to int casts in C are undefined behavior.
However, many newer languages prefer to have a float to integer cast that
is well-defined for all input
2017 Jul 25
2
Identify c-style pointer to array
HI all,
in C/C++, arrays and matrices often are passed as pointer so functions.
Suppose I'd like to write a pass operating on arrays , for example an
array of doubles passed via double * and checking for the type i will
identify a pointer to double (isAggregateType()=false).
As this style of passing arrays using pointers is widely used, I wonder
if there is any chance to identify a pointer
2015 Jun 26
6
[LLVMdev] Deriving undefined behavior from nsw/inbounds/poison for scalar evolution
*** Summary
I'd like to propose (and implement) functionality in LLVM to determine when
a poison value from an instruction is guaranteed to produce undefined
behavior. I want to use that to improve handling of nsw, inbounds etc.
flags in scalar evolution and LSR. I imagine that there would be other uses
for it. I'd like feedback on this idea before I proceed with it.
*** Details
Poison
2008 May 02
0
[LLVMdev] Pointer sizes, GetElementPtr, and offset sizes
On Fri, May 2, 2008 at 1:22 PM, Marc de Kruijf <dekruijf at cs.wisc.edu> wrote:
> The LLVA and LLVM papers motivate the GetElementPtr instruction by arguing
> that it abstracts implementation details, in particular pointer size, from
> the compiler. While it does this fine for pointer addresses, it does not
> manage it for address offsets. Consider the following code:
>
>
2015 Jun 30
5
[LLVMdev] Deriving undefined behavior from nsw/inbounds/poison for scalar evolution
Hi Adam,
Indvar widening can sometimes be harmful for architectures (e.g. NVPTX and
AMDGPU) where wider integer operations are more expensive (
https://llvm.org/bugs/show_bug.cgi?id=21148). For this reason, we disabled
indvar widening in NVPTX in http://reviews.llvm.org/D6196.
Hope it helps.
Jingyue
On Mon, Jun 29, 2015 at 11:59 AM Adam Nemet <anemet at apple.com> wrote:
>
> >