D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19310 - VRP for array casts
Summary: VRP for array casts
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2018-10-18 09:47 UTC by anonymous4
Modified: 2024-12-13 19:00 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description anonymous4 2018-10-18 09:47:47 UTC
long[] f(byte[] a)
{
    return cast(long[])a[0..a.length/8*8];
}

Here the compiler can see that the array length is multiple of 8 and simply divide the length by 8 for the cast.
Comment 1 dlangBugzillaToGithub 2024-12-13 19:00:58 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19497

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB