On Wednesday, 23 October 2019 at 11:20:59 UTC, Per Nordlöw wrote:
Does DMD/LDC avoid range-checking in slice-expressions such as
the one in my array-overload of `startsWith` defined as
bool startsWith(T)(scope const(T)[] haystack,
scope const(T)[] needle)
{
if (haystack.l
On Friday, 25 October 2019 at 21:33:26 UTC, Per Nordlöw wrote:
But it requires the function to be qualified as @trusted which
might hide a @system == operator. How common is it for a ==
operator to be unsafe?
Ping.
On Wednesday, 23 October 2019 at 13:51:19 UTC, kinke wrote:
You call this messy?!
cmpq%rdi, %rdx
jae .LBB0_2
xorl%eax, %eax
retq
.LBB0_2:
movq%rdi, %rax
testq %rdi, %rdi
je .LBB0_3
pushq %rax
.cfi_def_cfa_of
On Wednesday, 23 October 2019 at 11:20:59 UTC, Per Nordlöw wrote:
Does DMD/LDC avoid range-checking in slice-expressions such as
the one in my array-overload of `startsWith` defined as
bool startsWith(T)(scope const(T)[] haystack,
scope const(T)[] needle)
{
if (haystack.l
On Friday, 25 October 2019 at 15:22:12 UTC, Ali Çehreli wrote:
On 10/25/2019 05:37 AM, Stefan Koch wrote:
just replace x = a[i] with x = a.ptr[i];
That's a neat trick!
Ali
But it requires the function to be qualified as @trusted which
might hide a @system == operator. How common is it for
On 10/25/2019 05:37 AM, Stefan Koch wrote:
just replace x = a[i] with x = a.ptr[i];
That's a neat trick!
Ali
On Thursday, 24 October 2019 at 21:02:03 UTC, Per Nordlöw wrote:
On Thursday, 24 October 2019 at 18:37:05 UTC, welkam wrote:
I remember in some video Chandler Carruth said that value
range propagation across function boundary was implemented in
llvm but later removed because it produced no perf
On Wednesday, 23 October 2019 at 12:01:47 UTC, Per Nordlöw wrote:
On Wednesday, 23 October 2019 at 11:33:56 UTC, kinke wrote:
For your example, the template is inferred to be @safe, and
`-release` only elides bounds checks in @system functions
(corresponding to `-boundscheck=safeonly`). Use
`-
On Wednesday, 23 October 2019 at 14:52:42 UTC, kinke wrote:
godbolt.org supports D as well and is way more powerful than
run.dlang.io, besides offering way more LDC versions to choose
from. It can also be used to remove the 'cluttering':
https://d.godbolt.org/z/ejEmrK
Very useful. Especially
On Thursday, 24 October 2019 at 18:37:05 UTC, welkam wrote:
I remember in some video Chandler Carruth said that value range
propagation across function boundary was implemented in llvm
but later removed because it produced no performance
improvement for C and C++ code. I wonder how it fare when
On Wednesday, 23 October 2019 at 11:20:59 UTC, Per Nordlöw wrote:
Does DMD/LDC avoid range-checking in slice-expressions such as
the one in my array-overload of `startsWith` defined as
bool startsWith(T)(scope const(T)[] haystack,
scope const(T)[] needle)
{
if (haystack.l
On Wednesday, 23 October 2019 at 13:08:34 UTC, Per Nordlöw wrote:
Is it possible to remove cluttering?
godbolt.org supports D as well and is way more powerful than
run.dlang.io, besides offering way more LDC versions to choose
from. It can also be used to remove the 'cluttering':
https://d.g
On Wednesday, 23 October 2019 at 13:08:34 UTC, Per Nordlöw wrote:
The ASM- and IR-output from the following code is pretty messy
for
You call this messy?!
cmpq%rdi, %rdx
jae .LBB0_2
xorl%eax, %eax
retq
.LBB0_2:
movq%rdi, %rax
testq %rdi
On Wednesday, 23 October 2019 at 11:33:56 UTC, kinke wrote:
Simply check the IR or asm, e.g., on run.dlang.io. If there's a
call to `_d_arraybounds` in the function of interest, bounds
checks are enabled.
The ASM- and IR-output from the following code is pretty messy for
ldc with flags `-r
On Wednesday, 23 October 2019 at 11:33:56 UTC, kinke wrote:
For your example, the template is inferred to be @safe, and
`-release` only elides bounds checks in @system functions
(corresponding to `-boundscheck=safeonly`). Use
`-boundscheck=off` to elide it in all functions.
Thanks. But I'm ta
On Wednesday, 23 October 2019 at 11:20:59 UTC, Per Nordlöw wrote:
How can I investigate the codegen myself here?
Simply check the IR or asm, e.g., on run.dlang.io. If there's a
call to `_d_arraybounds` in the function of interest, bounds
checks are enabled.
For your example, the template is
Does DMD/LDC avoid range-checking in slice-expressions such as
the one in my array-overload of `startsWith` defined as
bool startsWith(T)(scope const(T)[] haystack,
scope const(T)[] needle)
{
if (haystack.length >= needle.length)
{
return haystack[0 .. needle.l
17 matches
Mail list logo