{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/54296489","id":54296489,"diff_hunk":"@@ -7837,7 +7837,9 @@ GenTree *           Compiler::optIsBoolCond(GenTree *   condBranch,\n     if  (opr2->gtOper != GT_CNS_INT)\n         return  NULL;\n \n-    if  (((unsigned) opr2->gtIntCon.gtIconVal) > 1)\n+    ssize_t ival2 = opr2->gtIntCon.gtIconVal;\n+\n+    if (ival2 != 0 && ival2 != 1)\n         return NULL;\n ","path":"src/jit/optimizer.cpp","position":9,"original_position":9,"commit_id":"fbdd95218427aa9be25aaa7730f10e4707404c71","original_commit_id":"fbdd95218427aa9be25aaa7730f10e4707404c71","user":{"login":"cmckinsey","id":10263476,"avatar_url":"https://avatars.githubusercontent.com/u/10263476?v=3","gravatar_id":"","url":"https://api.github.com/users/cmckinsey","html_url":"https://github.com/cmckinsey","followers_url":"https://api.github.com/users/cmckinsey/followers","following_url":"https://api.github.com/users/cmckinsey/following{/other_user}","gists_url":"https://api.github.com/users/cmckinsey/gists{/gist_id}","starred_url":"https://api.github.com/users/cmckinsey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmckinsey/subscriptions","organizations_url":"https://api.github.com/users/cmckinsey/orgs","repos_url":"https://api.github.com/users/cmckinsey/repos","events_url":"https://api.github.com/users/cmckinsey/events{/privacy}","received_events_url":"https://api.github.com/users/cmckinsey/received_events","type":"User","site_admin":false},"body":"Same response as above.","created_at":"2016-02-26T20:20:22Z","updated_at":"2016-02-26T20:20:22Z","html_url":"https://github.com/dotnet/coreclr/pull/3381#discussion_r54296489","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/3381","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/54296489"},"html":{"href":"https://github.com/dotnet/coreclr/pull/3381#discussion_r54296489"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/3381"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/3381","id":60883145,"html_url":"https://github.com/dotnet/coreclr/pull/3381","diff_url":"https://github.com/dotnet/coreclr/pull/3381.diff","patch_url":"https://github.com/dotnet/coreclr/pull/3381.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/3381","number":3381,"state":"open","locked":false,"title":"Fix bug in optOptimizeBools for equality of 0/1.","user":{"login":"cmckinsey","id":10263476,"avatar_url":"https://avatars.githubusercontent.com/u/10263476?v=3","gravatar_id":"","url":"https://api.github.com/users/cmckinsey","html_url":"https://github.com/cmckinsey","followers_url":"https://api.github.com/users/cmckinsey/followers","following_url":"https://api.github.com/users/cmckinsey/following{/other_user}","gists_url":"https://api.github.com/users/cmckinsey/gists{/gist_id}","starred_url":"https://api.github.com/users/cmckinsey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmckinsey/subscriptions","organizations_url":"https://api.github.com/users/cmckinsey/orgs","repos_url":"https://api.github.com/users/cmckinsey/repos","events_url":"https://api.github.com/users/cmckinsey/events{/privacy}","received_events_url":"https://api.github.com/users/cmckinsey/received_events","type":"User","site_admin":false},"body":"The method optIsBoolCond had a clever way to test for a constant\r\nof value 0/1 by casting the resulting gtIconVal to (unsigned) and\r\ncomparing for <= 1. Unfortunately, for 64-bit targets gtIconVal as\r\nssize_t holds 64-bits and the cast to (unsigned) results in truncating\r\nsignificant bits and results in the optimization falsely recognizing\r\nlegal patterns of bit-tests comparing against 0/1. Because 32-bit\r\ntargets represent 64-bit long constants as GT_CNS_LNG they do not\r\nsuffer from this problem as the code already had exclusions for them.\r\n\r\nI've chosen to rewrite the code to use explicit comparisons that make\r\nthe intent of the code more obvious and readable. I've added a unit test\r\nto ensure the bug has been fixed in regression testing.\r\n\r\n@BruceForstall \r\n@dotnet/jit-contrib ","created_at":"2016-02-26T18:29:15Z","updated_at":"2016-02-26T20:20:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f4d768e9238b72b358a689a1d398f56c462a189","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/3381/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/3381/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/3381/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/fbdd95218427aa9be25aaa7730f10e4707404c71","head":{"label":"cmckinsey:DevDiv_168744","ref":"DevDiv_168744","sha":"fbdd95218427aa9be25aaa7730f10e4707404c71","user":{"login":"cmckinsey","id":10263476,"avatar_url":"https://avatars.githubusercontent.com/u/10263476?v=3","gravatar_id":"","url":"https://api.github.com/users/cmckinsey","html_url":"https://github.com/cmckinsey","followers_url":"https://api.github.com/users/cmckinsey/followers","following_url":"https://api.github.com/users/cmckinsey/following{/other_user}","gists_url":"https://api.github.com/users/cmckinsey/gists{/gist_id}","starred_url":"https://api.github.com/users/cmckinsey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmckinsey/subscriptions","organizations_url":"https://api.github.com/users/cmckinsey/orgs","repos_url":"https://api.github.com/users/cmckinsey/repos","events_url":"https://api.github.com/users/cmckinsey/events{/privacy}","received_events_url":"https://api.github.com/users/cmckinsey/received_events","type":"User","site_admin":false},"repo":{"id":32495337,"name":"coreclr","full_name":"cmckinsey/coreclr","owner":{"login":"cmckinsey","id":10263476,"avatar_url":"https://avatars.githubusercontent.com/u/10263476?v=3","gravatar_id":"","url":"https://api.github.com/users/cmckinsey","html_url":"https://github.com/cmckinsey","followers_url":"https://api.github.com/users/cmckinsey/followers","following_url":"https://api.github.com/users/cmckinsey/following{/other_user}","gists_url":"https://api.github.com/users/cmckinsey/gists{/gist_id}","starred_url":"https://api.github.com/users/cmckinsey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmckinsey/subscriptions","organizations_url":"https://api.github.com/users/cmckinsey/orgs","repos_url":"https://api.github.com/users/cmckinsey/repos","events_url":"https://api.github.com/users/cmckinsey/events{/privacy}","received_events_url":"https://api.github.com/users/cmckinsey/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cmckinsey/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","fork":true,"url":"https://api.github.com/repos/cmckinsey/coreclr","forks_url":"https://api.github.com/repos/cmckinsey/coreclr/forks","keys_url":"https://api.github.com/repos/cmckinsey/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cmckinsey/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cmckinsey/coreclr/teams","hooks_url":"https://api.github.com/repos/cmckinsey/coreclr/hooks","issue_events_url":"https://api.github.com/repos/cmckinsey/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/cmckinsey/coreclr/events","assignees_url":"https://api.github.com/repos/cmckinsey/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/cmckinsey/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/cmckinsey/coreclr/tags","blobs_url":"https://api.github.com/repos/cmckinsey/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cmckinsey/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cmckinsey/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/cmckinsey/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cmckinsey/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/cmckinsey/coreclr/languages","stargazers_url":"https://api.github.com/repos/cmckinsey/coreclr/stargazers","contributors_url":"https://api.github.com/repos/cmckinsey/coreclr/contributors","subscribers_url":"https://api.github.com/repos/cmckinsey/coreclr/subscribers","subscription_url":"https://api.github.com/repos/cmckinsey/coreclr/subscription","commits_url":"https://api.github.com/repos/cmckinsey/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/cmckinsey/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/cmckinsey/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/cmckinsey/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/cmckinsey/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/cmckinsey/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cmckinsey/coreclr/merges","archive_url":"https://api.github.com/repos/cmckinsey/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cmckinsey/coreclr/downloads","issues_url":"https://api.github.com/repos/cmckinsey/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/cmckinsey/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/cmckinsey/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/cmckinsey/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cmckinsey/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/cmckinsey/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/cmckinsey/coreclr/deployments","created_at":"2015-03-19T02:05:13Z","updated_at":"2016-02-26T18:20:20Z","pushed_at":"2016-02-26T18:21:26Z","git_url":"git://github.com/cmckinsey/coreclr.git","ssh_url":"git@github.com:cmckinsey/coreclr.git","clone_url":"https://github.com/cmckinsey/coreclr.git","svn_url":"https://github.com/cmckinsey/coreclr","homepage":"","size":60635,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"3e8d97edfef3e8492cf9f0b2e52dfa9570d2a33e","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":30092893,"name":"coreclr","full_name":"dotnet/coreclr","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","fork":false,"url":"https://api.github.com/repos/dotnet/coreclr","forks_url":"https://api.github.com/repos/dotnet/coreclr/forks","keys_url":"https://api.github.com/repos/dotnet/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/coreclr/teams","hooks_url":"https://api.github.com/repos/dotnet/coreclr/hooks","issue_events_url":"https://api.github.com/repos/dotnet/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/coreclr/events","assignees_url":"https://api.github.com/repos/dotnet/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/coreclr/tags","blobs_url":"https://api.github.com/repos/dotnet/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/coreclr/languages","stargazers_url":"https://api.github.com/repos/dotnet/coreclr/stargazers","contributors_url":"https://api.github.com/repos/dotnet/coreclr/contributors","subscribers_url":"https://api.github.com/repos/dotnet/coreclr/subscribers","subscription_url":"https://api.github.com/repos/dotnet/coreclr/subscription","commits_url":"https://api.github.com/repos/dotnet/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/coreclr/merges","archive_url":"https://api.github.com/repos/dotnet/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/coreclr/downloads","issues_url":"https://api.github.com/repos/dotnet/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/coreclr/deployments","created_at":"2015-01-30T22:10:02Z","updated_at":"2016-02-26T18:38:07Z","pushed_at":"2016-02-26T20:01:52Z","git_url":"git://github.com/dotnet/coreclr.git","ssh_url":"git@github.com:dotnet/coreclr.git","clone_url":"https://github.com/dotnet/coreclr.git","svn_url":"https://github.com/dotnet/coreclr","homepage":"http://dotnet.github.io/","size":65572,"stargazers_count":5935,"watchers_count":5935,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1314,"mirror_url":null,"open_issues_count":563,"forks":1314,"open_issues":563,"watchers":5935,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/3381"},"html":{"href":"https://github.com/dotnet/coreclr/pull/3381"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/3381"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/3381/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/3381/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/3381/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/fbdd95218427aa9be25aaa7730f10e4707404c71"}}}}