Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 20, 2015 __assume | ||||
---|---|---|---|---|
| ||||
Commercial compilers provide a way to tell the compiler invariants that are known to always hold, e.g. MSVC provides __assume(x). LLVM eliminates such assumptions prematurely according to this link: https://github.com/preames/llvm-assume-hack Does this also affect: http://llvm.org/docs/LangRef.html#llvm-assume-intrinsic ? Does LDC provide some means for providing assumptions to the compiler, for library authors? One use case is to provide assumptions about alignment of void pointers and similar constrains that are known to hold for library ADTs. |
February 20, 2015 Re: __assume | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ola Fosheim Grøstad | On 20 Feb 2015, at 10:33, via digitalmars-d-ldc wrote: > Does LDC provide some means for providing assumptions to the compiler, for library authors? One use case is to provide assumptions about alignment of void pointers and similar constrains that are known to hold for library ADTs. Not yet. I wondered how to best implement this a while back, but decided that I needed to have a more in-depth look at the related parts of the LLVM infrastructure to be able to decide on the best design. I didn't quite get around to that since. It seems like Rust chose a very simple implementation (https://github.com/rust-lang/rust/issues/18051), which would be trivial to add to LDC's druntime. Pull requests are very welcome, as always. Cheers, David |
February 21, 2015 Re: __assume | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ola Fosheim Grøstad | On 20 Feb 2015, at 10:33, via digitalmars-d-ldc wrote: > Does LDC provide some means for providing assumptions to the compiler, for library authors? One use case is to provide assumptions about alignment of void pointers and similar constrains that are known to hold for library ADTs. Not yet. I wondered how to best implement this a while back, but decided that I needed to have a more in-depth look at the related parts of the LLVM infrastructure to be able to decide on the best design. I didn't quite get around to that since. It seems like Rust chose a very simple implementation (https://github.com/rust-lang/rust/issues/18051), which would be trivial to add to LDC's druntime. Pull requests are very welcome, as always. Cheers, David |
February 21, 2015 Re: __assume | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On Saturday, 21 February 2015 at 17:34:32 UTC, David Nadlinger wrote:
> It seems like Rust chose a very simple implementation
> (https://github.com/rust-lang/rust/issues/18051), which would be trivial
> to add to LDC's druntime. Pull requests are very welcome, as always.
Hm... yes... the argument might be reduced to "true", but maybe that is ok.
|
Copyright © 1999-2021 by the D Language Foundation