digitalmars.D.bugs - [Issue 14436] New: Optimizer fails to remove comparison loop when
- via Digitalmars-d-bugs (29/29) Apr 10 2015 https://issues.dlang.org/show_bug.cgi?id=14436
https://issues.dlang.org/show_bug.cgi?id=14436 Issue ID: 14436 Summary: Optimizer fails to remove comparison loop when comparing array against null Product: D Version: D1 & D2 Hardware: All OS: All Status: NEW Keywords: performance Severity: enhancement Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: yebblies gmail.com The comparison in this code int[] arr; void main() { if (arr != null) { arr = [1]; } } gets lowered to !arr.length && !memcmp(arr.ptr, null, arr.length) The optimizer should be able to tell that the memcmp would always return 0 and skip the check. --
Apr 10 2015