{"action":"opened","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/31002","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/31002/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/31002/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/31002/events","html_url":"https://github.com/rust-lang/rust/issues/31002","id":127274309,"number":31002,"title":"[MIR] Requiring TempRef to only be assigned to once may be too restrictive","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":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-18T17:25:33Z","updated_at":"2016-01-18T17:25:33Z","closed_at":null,"body":"In MIR we want `tmp*` values to be SSA, however ensuring that constraint in trans (i.e. in TempRef) is wrong, I think.\r\n\r\nNamely, for code like this:\r\n\r\n```rust\r\n#![feature(rustc_attrs)]\r\nstruct A(f32);\r\n#[rustc_mir(graphviz=\"mir.gv\")]\r\nfn mir(f: f32) -> bool { !(f.is_nan() || f.is_infinite()) }\r\nfn main() { println!(\"{:?}\", mir(0.0)); }\r\n```\r\n\r\nwe will generate following MIR (graphviz version, because easier to visualise):\r\n\r\n![MIR](https://cloud.githubusercontent.com/assets/679122/12397917/ef4d8660-be18-11e5-9414-b4138816006f.png)\r\n\r\nNote how we assign `tmp0` twice, but the two branches are fully disjoint, and thus, for the purposes of data-flow `tmp0` is still SSA, but for the purposes of translator `tmp0` is assigned multiple times.\r\n\r\nIf we want `TempRef`s to stay `SSA` across translation of the whole function, we will need something like a `phi` in the translator.\r\n\r\ncc @nikomatsakis "}}