{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/33567","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/33567/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/33567/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/33567/events","html_url":"https://github.com/rust-lang/rust/issues/33567","id":154336105,"number":33567,"title":"Convert the default-case optimisation to a MIR pass","user":{"login":"nagisa","id":679122,"avatar_url":"https://avatars.githubusercontent.com/u/679122?v=3","gravatar_id":"","url":"https://api.github.com/users/nagisa","html_url":"https://github.com/nagisa","followers_url":"https://api.github.com/users/nagisa/followers","following_url":"https://api.github.com/users/nagisa/following{/other_user}","gists_url":"https://api.github.com/users/nagisa/gists{/gist_id}","starred_url":"https://api.github.com/users/nagisa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagisa/subscriptions","organizations_url":"https://api.github.com/users/nagisa/orgs","repos_url":"https://api.github.com/users/nagisa/repos","events_url":"https://api.github.com/users/nagisa/events{/privacy}","received_events_url":"https://api.github.com/users/nagisa/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-mir","name":"A-mir","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-05-11T20:31:54Z","updated_at":"2016-05-26T16:37:45Z","closed_at":null,"body":"https://github.com/rust-lang/rust/pull/33566 introduces an optimisation which speeds up LLVM greatly. My suspicion is that this optimisation is also very relevant to the MIR pipeline (i.e. MIR transformations ought to be slower to analyse and transform the switches with more branches). Thus we should port this optimisation over to a MIR pass down the line.\r\n\r\nMoreover, the code in the PR relies on the assumption that the `otherwise` branch of the switches is always unreachable. This assumption has potential to become not true after we get more complex optimisations on the MIR going. Having such optimisation to be a plain MIR transformation would help with this too.\r\n\r\ncc @dotdash "},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/221925693","html_url":"https://github.com/rust-lang/rust/issues/33567#issuecomment-221925693","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/33567","id":221925693,"user":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"created_at":"2016-05-26T16:37:45Z","updated_at":"2016-05-26T16:37:45Z","body":"Here are some test cases (just for reference) that exhibit the N^2 blowup we observed (at least initially). Note that the one that uses integral constants does not: I think the simplest fix to the blowup is just to have the enum case use a similar pattern to what constants do, where it figures out which variants are \"of interest\" and creates an otherwise-like block to use as the target for the remainder (we might also change the IR; just seems orthogonal).\r\n\r\nhttps://gist.github.com/nikomatsakis/dc3641659919d11b01a6fc14051831bd"}}
{"actor":{"display_login":"nikomatsakis"}}