search for: addrspacecast

Displaying 20 results from an estimated 81 matches for "addrspacecast".

2015 Mar 16
4
[LLVMdev] possible addrspacecast problem
Given a pointer, does any addrspacecast affect the pointer's dereferenceablity ? For example, %pm = addrspaacecast float addrspacecast(n)* %pn to float addrspacecast(m)* %r = load float addrspace(m)* %pm In another word. the question is whether the following is true ? isDereferenceablePointer(pn) == isDereferenceablePoi...
2014 Mar 25
5
[LLVMdev] Reducing Generic Address Space Usage
...g non-generic ones (such as shared and constant),. Here is an example Justin gave: %ptr = ... %val = load i32* %ptr In this case, %ptr is a generic address space pointer (assuming an address space mapping where 0 is generic). But if an analysis can prove that the pointer %ptr was originally addrspacecast'd from a specific address space (or some other mechanism through which the pointer's specific address space can be determined), it may be beneficial to explicitly convert the IR to something like: %ptr = ... %ptr.0 = addrspacecast i32* to i32 addrspace(3)* %val = load i32 addrspace(3...
2014 Mar 26
3
[LLVMdev] Reducing Generic Address Space Usage
...att Arsenault <Matthew.Arsenault at amd.com>wrote: > On 03/25/2014 02:31 PM, Jingyue Wu wrote: > > > However, we have three concerns on this: > a) I doubt this optimization is valid for all targets, because LLVM > language reference ( > http://llvm.org/docs/LangRef.html#addrspacecast-to-instruction) says > addrspacecast "can be a no-op cast or a complex value modification, > depending on the target and the address space pair." > > I think most of the simple cast optimizations would be acceptable. The > addrspacecasted pointer still needs to point to the...
2014 Feb 05
2
[LLVMdev] Pattern matching addrspacecast?
Hi all, the addrspacecast stuff has landed and I'm now seeing failures in our back end because clang is emitting them, they're travelling through the IR to the SelectionDAG, and there's nothing to match them. Trying to match them, I get an error from TableGen saying: Variable not defined: 'addrspacecast...
2015 Dec 14
3
Getting TargetLowering in AsmPrinter / Lowering constant addrspacecast
Hi, I'd like to add support for addrspacecast in initializers of global variables, at least for the trivial case. The trivial case is if TargetLowering::isNoopAddrSpaceCast(SrcAS, DestAS) returns true. In this case the MCExpr for the addrspacecast is the MCExpr of its first operand. It seems hard to obtain an instance of TargetLowering...
2012 Sep 11
2
[LLVMdev] FW: Proposal: New IR instruction for casting between address spaces
...s case explicitely. Proposed changes: * Add restriction to the verifier on the bitcast instruction making bitcasting between address spaces illegal. * Change documentation[3] to state the bitcast to pointers of different address spaces is illegal. * Add in a new IR node, addrspacecast, that allows conversions between address spaces * Updated the reader/writer to handle these cases * Update the documentation to insert the new IR node. * Add the following documentation: 'addrspacecast .. to' Instruction Syntax: <result> = addrspacecast...
2015 Mar 17
2
[LLVMdev] possible addrspacecast problem
On 16 Mar 2015, at 08:25, Sanjoy Das <sanjoy at playingwithpointers.com> wrote: > > The LangRef says this about addrspacecast: "Note that if the address > space conversion is legal then both result and operand refer to the > same memory location.". This brings forth two related questions: > > 1. what happens if you execute an "invalid" addrspacecast? Does this > axiom make addrspac...
2015 Mar 18
2
[LLVMdev] possible addrspacecast problem
...our architecture, this results in different bounds information being available on the pointer and a run-time crash. We could represent casts with a target-specific intrinsic, but we'd rather avoid that if possible. This is not fixed by changing isSafeToSpeculativelyExecute to return false for AddrSpaceCast, so I'll need to dig a bit more to understand exactly when and why it happens. > > Like to know what is causing this. I should start with a disclaimer that I haven't pulled in upstream LLVM for a couple of months, so this might already be fixed... After SROA, we're left with th...
2019 Jun 11
3
[InstCombine] addrspacecast assumed associative with gep
The following combine(-enabling transformation) makes me uncomfortable:   gep(addrspacecast(gep p0) to p1)   addrspacecast(gep(gep p0)) to p1 It's applied at visitAddrSpaceCast in InstCombineCasts.cpp. Before this, I'd always assumed address spaces were very much "user domain". Datalayout even supports marking a space as "non-integral", to designate that manipu...
2017 Jan 03
2
Optimisation passes introducing address space casts
OK, I’ve hit one more existing regression test that I’m weary of: define void @test2_addrspacecast() { %A = alloca %T %B = alloca %T %a = addrspacecast %T* %A to i8 addrspace(1)* %b = addrspacecast %T* %B to i8 addrspace(1)* call void @llvm.memcpy.p1i8.p0i8.i64(i8 addrspace(1)* %a, i8* bitcast (%T* @G to i8*), i64 124, i32 4, i1 false) call void @llvm.memcpy.p...
2012 Sep 11
0
[LLVMdev] Proposal: New IR instruction for casting between address spaces
...; > Proposed changes: > · Add restriction to the verifier on the bitcast instruction making bitcasting between address spaces illegal. > · Change documentation[3] to state the bitcast to pointers of different address spaces is illegal. > · Add in a new IR node, addrspacecast, that allows conversions between address spaces > · Updated the reader/writer to handle these cases > · Update the documentation to insert the new IR node. > · Add the following documentation: > 'addrspacecast .. to' Instruction > > Syntax: > &...
2012 Sep 11
2
[LLVMdev] Proposal: New IR instruction for casting between address spaces
...: > > * Add restriction to the verifier on the bitcast instruction > making bitcasting between address spaces illegal. > > * Change documentation[3] to state the bitcast to pointers of > different address spaces is illegal. > > * Add in a new IR node, addrspacecast, that allows conversions > between address spaces > > * Updated the reader/writer to handle these cases > > * Update the documentation to insert the new IR node. > > * Add the following documentation: > > 'addrspacecast .. to' Instruction &...
2019 Jun 17
2
[InstCombine] addrspacecast assumed associative with gep
...omic flags. Modelled as address spaces, p0 and p<bit> would have different CHAR_BITs, of 8 and 1 respectively. This somewhat works as one would expect too, with, ((bit *)&somevalue)[3] producing bit3 of somevalue - at least until the first time you access through a struct or array: gep(addrspacecast(gep p0, 4) to p<bit>, 3) == (p0 + 4) * 8 + 3 As LLVM optimises this expression to: addrspacecast(gep p0, 4 + 3) to p<bit> Producing something entirely different. But that said, I cannot think of a case where this would be a problem _except_ where CHAR_BIT would be different in one...
2017 Jan 02
3
Optimisation passes introducing address space casts
...e just failing to keep the property that the load is performed through addrspace(2). Based on this comment, I am suspicious of the validity of a couple of existing instcombine regression tests in `memcpy-from-global.ll`. Specifically, there are two tests that look like this: define void @test3_addrspacecast() { %A = alloca %T %a = bitcast %T* %A to i8* call void @llvm.memcpy.p0i8.p1i8.i64(i8* %a, i8 addrspace(1)* addrspacecast (%T* @G to i8 addrspace(1)*), i64 124, i32 4, i1 false) call void @bar(i8* %a) readonly ; CHECK-LABEL: @test3_addrspacecast( ; CHECK-NEXT: call void @bar(i8*...
2014 Jan 27
2
[LLVMdev] Is addrspacecast implemented on Windows?
...magic values?) How can I use this in IR? I want to express this assembler code in IR: mov RAX, 8; mov RAX, GS:[RAX]; ret; I tried the following: define i64 @getStackBottom(i64 %addr) { entry: %ptr = inttoptr i64 %addr to i64* %fs_ptr = addrspacecast i64* %ptr to i64 addrspace(256)* %bottom = load i64 addrspace(256)* %fs_ptr, align 1 ret i64 %bottom } but this results in LLVM ERROR: Cannot select: 0xcc6c60: i64 = addrspacecast 0xcc6b60[0 -> 256] [ORD=3] [ID=6] 0xcc6b60: i64,ch = CopyFromReg 0xc95e38, 0xcc6a60 [ORD=1] [ID=5]...
2014 Aug 21
2
[LLVMdev] Any Optimization Suggestion to Get Rid of AddrSpaceCast around PHI
In the following example, for some reasons, the input pointer entering the loop was casted to generic pointer. How can the backend get rid of the addrspacecast and use local store in the loop? for.body.lr.ph: ; preds = %entry %0 = addrspacecast i32 addrspace(3)* %in to i32 addrspace(4)* br label %for.body for.body: ; preds = %for.body, %for.body.lr.ph %i.03 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ] %ptr.02 = phi i32 addrspace(4)* [ %0,...
2015 Sep 07
3
RFC: alloca -- specify address space for allocation
On 2 Sep 2015, at 02:54, Joseph Tremoulet via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Reading further, I see both that addrspacecast "can be a no-op cast or a complex value modification"[2] and that bitcast "may only be [used on pointers] with the same address space"[4]. > > So I'm getting the impression that it's ok to have a model with semantically meaningful aliasing between address spaces,...
2015 Oct 06
2
when would I use addrspacecast?
I was reading the LangRef for semantics of an instruction and came across addrspacecast. I've never needed it, so I suppose I don't care about it. But, why does it exist? What problem is it trying to solve?
2012 Sep 12
0
[LLVMdev] Proposal: New IR instruction for casting between address spaces
...Add restriction to the verifier on the bitcast instruction >> making bitcasting between address spaces illegal. >>> * Change documentation[3] to state the bitcast to pointers of >> different address spaces is illegal. >>> * Add in a new IR node, addrspacecast, that allows conversions >> between address spaces >>> * Updated the reader/writer to handle these cases >>> * Update the documentation to insert the new IR node. >>> * Add the following documentation: >>> 'addrspacecast .. to...
2012 Sep 12
2
[LLVMdev] Proposal: New IR instruction for casting between address spaces
...verifier on the bitcast > instruction > >> making bitcasting between address spaces illegal. > >>> * Change documentation[3] to state the bitcast to pointers > of > >> different address spaces is illegal. > >>> * Add in a new IR node, addrspacecast, that allows > conversions > >> between address spaces > >>> * Updated the reader/writer to handle these cases > >>> * Update the documentation to insert the new IR node. > >>> * Add the following documentation: > >>&g...