digitalmars.D.ldc - __assume
- "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= (12/12) Feb 20 2015 Commercial compilers provide a way to tell the compiler
- David Nadlinger via digitalmars-d-ldc (10/14) Feb 20 2015 Not yet. I wondered how to best implement this a while back, but decided...
- David Nadlinger via digitalmars-d-ldc (10/14) Feb 21 2015 Not yet. I wondered how to best implement this a while back, but decided
- "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= (4/9) Feb 21 2015 Hm... yes... the argument might be reduced to "true", but maybe
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.
Feb 20 2015
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
Feb 20 2015
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
Feb 21 2015
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.
Feb 21 2015