Bug 13169 – Optimization - final switch need not check for default case

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-20T21:13:48Z
Last change time
2024-12-13T18:22:28Z
Assigned to
No Owner
Creator
Walter Bright
Moved to GitHub: dmd#17669 →

Comments

Comment #0 by bugzilla — 2014-07-20T21:13:48Z
void A(); void B(); void C(); void D(); void E(); void test(int i) { while (1) { final switch (i) { case 1: A(); break; case 2: B(); break; case 3: C(); break; case 4: D(); break; case 5: E(); break; } ++i; } } An overflow check is done before dispatch, even with -O -release -noboundscheck. See also: http://eli.thegreenplace.net/2012/07/12/computed-goto-for-efficient-dispatch-tables/
Comment #1 by andrei — 2014-07-20T22:39:00Z
So the idea here is to disable the test in the presence of -noboundscheck?
Comment #2 by robert.schadek — 2024-12-13T18:22:28Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17669 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB