Johan Tibell
2012-Jan-19 02:13 UTC
[LLVMdev] TBAA: Propagating aliasing information to derived pointers
Hi, While adding support for TBAA to GHC's LLVM backend, we ran into the following issue: given a pointer that we know has certain aliasing properties (e.g. it points to the stack, not the heap) we'd like to * annotate all loads and stores to that pointer with a TBAA type "stack", and * also annotate all loads and stores to pointers derived from that pointer as "stack". For example, given Sp, which is the GHC stack pointer, and this pseudo-code tmp = Sp + 4 tmp2 = load tmp // should be marked as "stack" we'd like to not only annotate loads/stores to Sp as "stack" but also all loads/stores to tmp. Is this something that can be achieved within the current framework or should we propagate the pointer aliasing information ourselves? Cheers, Johan
Eli Friedman
2012-Jan-19 02:22 UTC
[LLVMdev] TBAA: Propagating aliasing information to derived pointers
On Wed, Jan 18, 2012 at 6:13 PM, Johan Tibell <johan.tibell at gmail.com> wrote:> Hi, > > While adding support for TBAA to GHC's LLVM backend, we ran into the > following issue: given a pointer that we know has certain aliasing > properties (e.g. it points to the stack, not the heap) we'd like to > > * annotate all loads and stores to that pointer with a TBAA type "stack", and > * also annotate all loads and stores to pointers derived from that > pointer as "stack". > > For example, given Sp, which is the GHC stack pointer, and this pseudo-code > > tmp = Sp + 4 > tmp2 = load tmp // should be marked as "stack" > > we'd like to not only annotate loads/stores to Sp as "stack" but also > all loads/stores to tmp. > > Is this something that can be achieved within the current framework or > should we propagate the pointer aliasing information ourselves?In the current TBAA implementation, the marking only applies to the given load; it doesn't give any special properties to the loaded pointer. -Eli
Johan Tibell
2012-Jan-31 01:49 UTC
[LLVMdev] TBAA: Propagating aliasing information to derived pointers
On Wed, Jan 18, 2012 at 6:22 PM, Eli Friedman <eli.friedman at gmail.com> wrote:> On Wed, Jan 18, 2012 at 6:13 PM, Johan Tibell <johan.tibell at gmail.com> wrote: >> While adding support for TBAA to GHC's LLVM backend, we ran into the >> following issue: given a pointer that we know has certain aliasing >> properties (e.g. it points to the stack, not the heap) we'd like to >> >> * annotate all loads and stores to that pointer with a TBAA type "stack", and >> * also annotate all loads and stores to pointers derived from that >> pointer as "stack". >> >> For example, given Sp, which is the GHC stack pointer, and this pseudo-code >> >> tmp = Sp + 4 >> tmp2 = load tmp // should be marked as "stack" >> >> we'd like to not only annotate loads/stores to Sp as "stack" but also >> all loads/stores to tmp. >> >> Is this something that can be achieved within the current framework or >> should we propagate the pointer aliasing information ourselves? > > In the current TBAA implementation, the marking only applies to the > given load; it doesn't give any special properties to the loaded > pointer.Is there a particular reason the current implementation doesn't do it (i.e. is it unsafe in general?) or is it just that no one has gotten around to implementing it? Cheers, Johan