{"action":"created","issue":{"url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues/348","repository_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools","labels_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues/348/labels{/name}","comments_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues/348/comments","events_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues/348/events","html_url":"https://github.com/KhronosGroup/SPIRV-Tools/pull/348","id":171026501,"number":348,"title":"Do not use SetOpCode() to freeze spec constants","user":{"login":"Qining","id":2983685,"avatar_url":"https://avatars.githubusercontent.com/u/2983685?v=3","gravatar_id":"","url":"https://api.github.com/users/Qining","html_url":"https://github.com/Qining","followers_url":"https://api.github.com/users/Qining/followers","following_url":"https://api.github.com/users/Qining/following{/other_user}","gists_url":"https://api.github.com/users/Qining/gists{/gist_id}","starred_url":"https://api.github.com/users/Qining/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Qining/subscriptions","organizations_url":"https://api.github.com/users/Qining/orgs","repos_url":"https://api.github.com/users/Qining/repos","events_url":"https://api.github.com/users/Qining/events{/privacy}","received_events_url":"https://api.github.com/users/Qining/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-13T20:41:29Z","updated_at":"2016-08-16T03:20:57Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/348","html_url":"https://github.com/KhronosGroup/SPIRV-Tools/pull/348","diff_url":"https://github.com/KhronosGroup/SPIRV-Tools/pull/348.diff","patch_url":"https://github.com/KhronosGroup/SPIRV-Tools/pull/348.patch"},"body":"Remove the opt::ir::Instruction::SetOpCode() interface.\r\n\r\nSpec constant freezing is done by adding new front-end constant\r\ninstructions and turning the original spec constant instruction to Nop."},"comment":{"url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues/comments/239991397","html_url":"https://github.com/KhronosGroup/SPIRV-Tools/pull/348#issuecomment-239991397","issue_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues/348","id":239991397,"user":{"login":"Qining","id":2983685,"avatar_url":"https://avatars.githubusercontent.com/u/2983685?v=3","gravatar_id":"","url":"https://api.github.com/users/Qining","html_url":"https://github.com/Qining","followers_url":"https://api.github.com/users/Qining/followers","following_url":"https://api.github.com/users/Qining/following{/other_user}","gists_url":"https://api.github.com/users/Qining/gists{/gist_id}","starred_url":"https://api.github.com/users/Qining/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Qining/subscriptions","organizations_url":"https://api.github.com/users/Qining/orgs","repos_url":"https://api.github.com/users/Qining/repos","events_url":"https://api.github.com/users/Qining/events{/privacy}","received_events_url":"https://api.github.com/users/Qining/received_events","type":"User","site_admin":false},"created_at":"2016-08-16T03:20:57Z","updated_at":"2016-08-16T03:20:57Z","body":"I think the reason for having this is that, setting opcode directly is generally an unsafe behavior. And that is also the reason why we have a TODO at that location. There may be rules for creating valid instructions, like different constructor for different subclass of instructions, and in the constructor we can impose rules to make sure the built instruction is somewhat 'more' likely to be valid. So having an interface to set arbitrary opcode looks quite dangerous.\r\n\r\nBut if we really want to keep the optimization framework lightweight, and let the user to take the full responsibility to generate valid code, we can keep the SetOpcode()."}}
{"actor":{"display_login":"Qining"}}