[LLVMdev] possible addrspacecast problem

Junjie Gu jgu222 at gmail.com
Tue Mar 17 11:06:28 PDT 2015

> In our architecture, address space casts will never trap and are
> deterministic (unless there is some asm with unmodelled side effects).
> However, there are pointers that can be dereferenced in one address space
> but not another: speculatively performing the load would be a real bug.
> Ideally, this would be a target-specific decision, but having the default
> be to not propagate the dereferencing information and allowing targets to
> opt in.


> I've just been debugging a related issue with regard to commutativity of
> address space casts with respect to other operations.  One of the
> optimisers is turning an add after an address space cast into an add before
> the address space cast.  On 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150317/db9d0244/attachment.html>

More information about the llvm-dev mailing list