{"action":"created","comment":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/50609889","id":50609889,"diff_hunk":"@@ -98,6 +119,21 @@ static void tryToReplaceWithDirectRangeIterator(Expr* iteratorExpr)\n       Expr* high = range->get(2)->copy();\n       iteratorExpr->replace(new CallExpr(\"chpl_direct_range_iter\", low, high, stride));\n     }\n+\n+    // replace a counted, low bounded range with unit stride with an equivalent\n+    // direct range iter. e.g. replace:\n+    //\n+    //   `low..#count` (which is equivalent to `low..low+count-1`)\n+    //\n+    // with:\n+    //\n+    //   `chpl_direct_range_iter(low, low+count-1, 1)`\n+    else if (count && range && range->isNamed(\"chpl_build_low_bounded_range\"))\n+    {\n+      Expr* low = range->get(2)->copy();","path":"compiler/AST/ForLoop.cpp","position":106,"original_position":106,"commit_id":"b29a9fa921b60618fe507925733d9b32ced2a30a","original_commit_id":"b29a9fa921b60618fe507925733d9b32ced2a30a","user":{"login":"ronawho","id":1588337,"avatar_url":"https://avatars.githubusercontent.com/u/1588337?v=3","gravatar_id":"","url":"https://api.github.com/users/ronawho","html_url":"https://github.com/ronawho","followers_url":"https://api.github.com/users/ronawho/followers","following_url":"https://api.github.com/users/ronawho/following{/other_user}","gists_url":"https://api.github.com/users/ronawho/gists{/gist_id}","starred_url":"https://api.github.com/users/ronawho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronawho/subscriptions","organizations_url":"https://api.github.com/users/ronawho/orgs","repos_url":"https://api.github.com/users/ronawho/repos","events_url":"https://api.github.com/users/ronawho/events{/privacy}","received_events_url":"https://api.github.com/users/ronawho/received_events","type":"User","site_admin":false},"body":"Will remove the enums from the signature and update this","created_at":"2016-01-23T00:39:49Z","updated_at":"2016-01-23T00:39:49Z","html_url":"https://github.com/chapel-lang/chapel/pull/3154#discussion_r50609889","pull_request_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3154","_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/50609889"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/3154#discussion_r50609889"},"pull_request":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3154"}}},"pull_request":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3154","id":56795377,"html_url":"https://github.com/chapel-lang/chapel/pull/3154","diff_url":"https://github.com/chapel-lang/chapel/pull/3154.diff","patch_url":"https://github.com/chapel-lang/chapel/pull/3154.patch","issue_url":"https://api.github.com/repos/chapel-lang/chapel/issues/3154","number":3154,"state":"open","locked":false,"title":"Optimize iteration over anonymous low-bounded counted ranges","user":{"login":"ronawho","id":1588337,"avatar_url":"https://avatars.githubusercontent.com/u/1588337?v=3","gravatar_id":"","url":"https://api.github.com/users/ronawho","html_url":"https://github.com/ronawho","followers_url":"https://api.github.com/users/ronawho/followers","following_url":"https://api.github.com/users/ronawho/following{/other_user}","gists_url":"https://api.github.com/users/ronawho/gists{/gist_id}","starred_url":"https://api.github.com/users/ronawho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronawho/subscriptions","organizations_url":"https://api.github.com/users/ronawho/orgs","repos_url":"https://api.github.com/users/ronawho/repos","events_url":"https://api.github.com/users/ronawho/events{/privacy}","received_events_url":"https://api.github.com/users/ronawho/received_events","type":"User","site_admin":false},"body":"Similar to how we optimize iteration over anonymous (possibly strided) fully\r\nbounded ranges (added with #1021), but for anonymous low-bounded counted\r\nranges.\r\n\r\nThis effectively replaces code like:\r\n\r\n```chapel\r\nfor i in low..#count {}  (range is equivalent to `low..low+count-1`)\r\n```\r\n\r\nwith:\r\n\r\n```chapel\r\nfor i in chpl_direct_range_iter(low, low+count-1, 1) {}\r\n```\r\n\r\nLow-bounded counted ranges are used a lot in our internal iterators (particular\r\nleader and standalone iterators) and are pretty common in user code because\r\nit's easier than writing `low..low+count-1`. Because of this it's worthwhile to\r\noptimize this specific case too. This was also listed in the next steps when\r\nthe anonymous range optimization was originally added. Note that this doesn't\r\nadd support for fully bounded counted ranges or counted and strided ranges.\r\n\r\nThis optimization has a pretty nice impact on the generated code but like the\r\noriginal optimization we don't expect this to have a huge impact on\r\nperformance. That said it is important for vectorization and it does eliminate\r\na few unnecessary function calls.\r\n\r\nSee 378c4b51bd19271c1f38397696a7320f5c737d6e for a generated code example.\r\n","created_at":"2016-01-21T19:17:16Z","updated_at":"2016-01-23T00:39:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fac0396a582006f4e1854f414290d3a7ade8d994","assignee":{"login":"bradcray","id":7536222,"avatar_url":"https://avatars.githubusercontent.com/u/7536222?v=3","gravatar_id":"","url":"https://api.github.com/users/bradcray","html_url":"https://github.com/bradcray","followers_url":"https://api.github.com/users/bradcray/followers","following_url":"https://api.github.com/users/bradcray/following{/other_user}","gists_url":"https://api.github.com/users/bradcray/gists{/gist_id}","starred_url":"https://api.github.com/users/bradcray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradcray/subscriptions","organizations_url":"https://api.github.com/users/bradcray/orgs","repos_url":"https://api.github.com/users/bradcray/repos","events_url":"https://api.github.com/users/bradcray/events{/privacy}","received_events_url":"https://api.github.com/users/bradcray/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3154/commits","review_comments_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3154/comments","review_comment_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/issues/3154/comments","statuses_url":"https://api.github.com/repos/chapel-lang/chapel/statuses/b29a9fa921b60618fe507925733d9b32ced2a30a","head":{"label":"ronawho:optimize-anonymous-counted-range-iteration","ref":"optimize-anonymous-counted-range-iteration","sha":"b29a9fa921b60618fe507925733d9b32ced2a30a","user":{"login":"ronawho","id":1588337,"avatar_url":"https://avatars.githubusercontent.com/u/1588337?v=3","gravatar_id":"","url":"https://api.github.com/users/ronawho","html_url":"https://github.com/ronawho","followers_url":"https://api.github.com/users/ronawho/followers","following_url":"https://api.github.com/users/ronawho/following{/other_user}","gists_url":"https://api.github.com/users/ronawho/gists{/gist_id}","starred_url":"https://api.github.com/users/ronawho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronawho/subscriptions","organizations_url":"https://api.github.com/users/ronawho/orgs","repos_url":"https://api.github.com/users/ronawho/repos","events_url":"https://api.github.com/users/ronawho/events{/privacy}","received_events_url":"https://api.github.com/users/ronawho/received_events","type":"User","site_admin":false},"repo":{"id":21908970,"name":"chapel","full_name":"ronawho/chapel","owner":{"login":"ronawho","id":1588337,"avatar_url":"https://avatars.githubusercontent.com/u/1588337?v=3","gravatar_id":"","url":"https://api.github.com/users/ronawho","html_url":"https://github.com/ronawho","followers_url":"https://api.github.com/users/ronawho/followers","following_url":"https://api.github.com/users/ronawho/following{/other_user}","gists_url":"https://api.github.com/users/ronawho/gists{/gist_id}","starred_url":"https://api.github.com/users/ronawho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronawho/subscriptions","organizations_url":"https://api.github.com/users/ronawho/orgs","repos_url":"https://api.github.com/users/ronawho/repos","events_url":"https://api.github.com/users/ronawho/events{/privacy}","received_events_url":"https://api.github.com/users/ronawho/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ronawho/chapel","description":"a Productive Parallel Programming Language","fork":true,"url":"https://api.github.com/repos/ronawho/chapel","forks_url":"https://api.github.com/repos/ronawho/chapel/forks","keys_url":"https://api.github.com/repos/ronawho/chapel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ronawho/chapel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ronawho/chapel/teams","hooks_url":"https://api.github.com/repos/ronawho/chapel/hooks","issue_events_url":"https://api.github.com/repos/ronawho/chapel/issues/events{/number}","events_url":"https://api.github.com/repos/ronawho/chapel/events","assignees_url":"https://api.github.com/repos/ronawho/chapel/assignees{/user}","branches_url":"https://api.github.com/repos/ronawho/chapel/branches{/branch}","tags_url":"https://api.github.com/repos/ronawho/chapel/tags","blobs_url":"https://api.github.com/repos/ronawho/chapel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ronawho/chapel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ronawho/chapel/git/refs{/sha}","trees_url":"https://api.github.com/repos/ronawho/chapel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ronawho/chapel/statuses/{sha}","languages_url":"https://api.github.com/repos/ronawho/chapel/languages","stargazers_url":"https://api.github.com/repos/ronawho/chapel/stargazers","contributors_url":"https://api.github.com/repos/ronawho/chapel/contributors","subscribers_url":"https://api.github.com/repos/ronawho/chapel/subscribers","subscription_url":"https://api.github.com/repos/ronawho/chapel/subscription","commits_url":"https://api.github.com/repos/ronawho/chapel/commits{/sha}","git_commits_url":"https://api.github.com/repos/ronawho/chapel/git/commits{/sha}","comments_url":"https://api.github.com/repos/ronawho/chapel/comments{/number}","issue_comment_url":"https://api.github.com/repos/ronawho/chapel/issues/comments{/number}","contents_url":"https://api.github.com/repos/ronawho/chapel/contents/{+path}","compare_url":"https://api.github.com/repos/ronawho/chapel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ronawho/chapel/merges","archive_url":"https://api.github.com/repos/ronawho/chapel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ronawho/chapel/downloads","issues_url":"https://api.github.com/repos/ronawho/chapel/issues{/number}","pulls_url":"https://api.github.com/repos/ronawho/chapel/pulls{/number}","milestones_url":"https://api.github.com/repos/ronawho/chapel/milestones{/number}","notifications_url":"https://api.github.com/repos/ronawho/chapel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ronawho/chapel/labels{/name}","releases_url":"https://api.github.com/repos/ronawho/chapel/releases{/id}","deployments_url":"https://api.github.com/repos/ronawho/chapel/deployments","created_at":"2014-07-16T16:46:31Z","updated_at":"2016-01-15T06:49:12Z","pushed_at":"2016-01-23T00:23:49Z","git_url":"git://github.com/ronawho/chapel.git","ssh_url":"git@github.com:ronawho/chapel.git","clone_url":"https://github.com/ronawho/chapel.git","svn_url":"https://github.com/ronawho/chapel","homepage":"http://chapel.cray.com/","size":343667,"stargazers_count":2,"watchers_count":2,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"chapel-lang:master","ref":"master","sha":"4eeecc63b63eceeb7fc98a1f0088229b38949711","user":{"login":"chapel-lang","id":7597261,"avatar_url":"https://avatars.githubusercontent.com/u/7597261?v=3","gravatar_id":"","url":"https://api.github.com/users/chapel-lang","html_url":"https://github.com/chapel-lang","followers_url":"https://api.github.com/users/chapel-lang/followers","following_url":"https://api.github.com/users/chapel-lang/following{/other_user}","gists_url":"https://api.github.com/users/chapel-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/chapel-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chapel-lang/subscriptions","organizations_url":"https://api.github.com/users/chapel-lang/orgs","repos_url":"https://api.github.com/users/chapel-lang/repos","events_url":"https://api.github.com/users/chapel-lang/events{/privacy}","received_events_url":"https://api.github.com/users/chapel-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":21663285,"name":"chapel","full_name":"chapel-lang/chapel","owner":{"login":"chapel-lang","id":7597261,"avatar_url":"https://avatars.githubusercontent.com/u/7597261?v=3","gravatar_id":"","url":"https://api.github.com/users/chapel-lang","html_url":"https://github.com/chapel-lang","followers_url":"https://api.github.com/users/chapel-lang/followers","following_url":"https://api.github.com/users/chapel-lang/following{/other_user}","gists_url":"https://api.github.com/users/chapel-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/chapel-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chapel-lang/subscriptions","organizations_url":"https://api.github.com/users/chapel-lang/orgs","repos_url":"https://api.github.com/users/chapel-lang/repos","events_url":"https://api.github.com/users/chapel-lang/events{/privacy}","received_events_url":"https://api.github.com/users/chapel-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chapel-lang/chapel","description":"a Productive Parallel Programming Language","fork":false,"url":"https://api.github.com/repos/chapel-lang/chapel","forks_url":"https://api.github.com/repos/chapel-lang/chapel/forks","keys_url":"https://api.github.com/repos/chapel-lang/chapel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chapel-lang/chapel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chapel-lang/chapel/teams","hooks_url":"https://api.github.com/repos/chapel-lang/chapel/hooks","issue_events_url":"https://api.github.com/repos/chapel-lang/chapel/issues/events{/number}","events_url":"https://api.github.com/repos/chapel-lang/chapel/events","assignees_url":"https://api.github.com/repos/chapel-lang/chapel/assignees{/user}","branches_url":"https://api.github.com/repos/chapel-lang/chapel/branches{/branch}","tags_url":"https://api.github.com/repos/chapel-lang/chapel/tags","blobs_url":"https://api.github.com/repos/chapel-lang/chapel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chapel-lang/chapel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chapel-lang/chapel/git/refs{/sha}","trees_url":"https://api.github.com/repos/chapel-lang/chapel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chapel-lang/chapel/statuses/{sha}","languages_url":"https://api.github.com/repos/chapel-lang/chapel/languages","stargazers_url":"https://api.github.com/repos/chapel-lang/chapel/stargazers","contributors_url":"https://api.github.com/repos/chapel-lang/chapel/contributors","subscribers_url":"https://api.github.com/repos/chapel-lang/chapel/subscribers","subscription_url":"https://api.github.com/repos/chapel-lang/chapel/subscription","commits_url":"https://api.github.com/repos/chapel-lang/chapel/commits{/sha}","git_commits_url":"https://api.github.com/repos/chapel-lang/chapel/git/commits{/sha}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/comments{/number}","issue_comment_url":"https://api.github.com/repos/chapel-lang/chapel/issues/comments{/number}","contents_url":"https://api.github.com/repos/chapel-lang/chapel/contents/{+path}","compare_url":"https://api.github.com/repos/chapel-lang/chapel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chapel-lang/chapel/merges","archive_url":"https://api.github.com/repos/chapel-lang/chapel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chapel-lang/chapel/downloads","issues_url":"https://api.github.com/repos/chapel-lang/chapel/issues{/number}","pulls_url":"https://api.github.com/repos/chapel-lang/chapel/pulls{/number}","milestones_url":"https://api.github.com/repos/chapel-lang/chapel/milestones{/number}","notifications_url":"https://api.github.com/repos/chapel-lang/chapel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chapel-lang/chapel/labels{/name}","releases_url":"https://api.github.com/repos/chapel-lang/chapel/releases{/id}","deployments_url":"https://api.github.com/repos/chapel-lang/chapel/deployments","created_at":"2014-07-09T18:15:54Z","updated_at":"2016-01-20T00:46:24Z","pushed_at":"2016-01-23T00:26:53Z","git_url":"git://github.com/chapel-lang/chapel.git","ssh_url":"git@github.com:chapel-lang/chapel.git","clone_url":"https://github.com/chapel-lang/chapel.git","svn_url":"https://github.com/chapel-lang/chapel","homepage":"http://chapel.cray.com/","size":438642,"stargazers_count":197,"watchers_count":197,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":64,"mirror_url":null,"open_issues_count":11,"forks":64,"open_issues":11,"watchers":197,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3154"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/3154"},"issue":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/3154"},"comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/3154/comments"},"review_comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3154/comments"},"review_comment":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3154/commits"},"statuses":{"href":"https://api.github.com/repos/chapel-lang/chapel/statuses/b29a9fa921b60618fe507925733d9b32ced2a30a"}}}}