{"action":"created","comment":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/49668192","id":49668192,"diff_hunk":"@@ -77,6 +77,13 @@ static void tryToReplaceWithDirectRangeIterator(Expr* iteratorExpr)\n   Expr* stride = NULL;\n   if (CallExpr* call = toCallExpr(iteratorExpr))\n   {\n+    // if we have a 1D domain constructor, just grab the inner range and see if\n+    // that can be optimized away\n+    if (call->isNamed(\"chpl__buildDomainExpr\") and call->numActuals() == 1)","path":"compiler/AST/ForLoop.cpp","position":6,"original_position":6,"commit_id":"5d135efec137c03bd4bf788fe5748ad575f9242b","original_commit_id":"5d135efec137c03bd4bf788fe5748ad575f9242b","user":{"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},"body":"Elliot, I'm too lazy to check: Is there any chance we use this same call to create other singleton domains (like, I'm thinking, an associative domain with one element in it?)","created_at":"2016-01-13T23:34:47Z","updated_at":"2016-01-13T23:34:47Z","html_url":"https://github.com/chapel-lang/chapel/pull/3105#discussion_r49668192","pull_request_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3105","_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/comments/49668192"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/3105#discussion_r49668192"},"pull_request":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3105"}}},"pull_request":{"url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3105","id":55970479,"html_url":"https://github.com/chapel-lang/chapel/pull/3105","diff_url":"https://github.com/chapel-lang/chapel/pull/3105.diff","patch_url":"https://github.com/chapel-lang/chapel/pull/3105.patch","issue_url":"https://api.github.com/repos/chapel-lang/chapel/issues/3105","number":3105,"state":"open","locked":false,"title":"Optimize anonymous 1-D domain iteration","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":"Optimize anonymous domain iteration much like we do anonymous range iteration.\r\n\r\n#1021 added an optimization to remove range constructor for iteration of\r\nanonymous ranges. This adds the optimization for anonymous domains as well. The\r\nanonymous range part looks for code of the form:\r\n\r\n    chpl_build_bounded_range(start, end, [stride])\r\n\r\nThis just updates that code to also look for\r\n\r\n    chpl__buildDomainExpr(chpl_build_bounded_range(start, end, [stride]))\r\n\r\nand applies the optimization to the inner range, discarding the domain\r\nconstructor.\r\n\r\nPreviously code like:\r\n\r\n```chapel\r\n  for i in {1..10} do writeln(i);\r\n```\r\n\r\nwould generate:\r\n\r\n```c\r\n  ret_to_arg_ref_tmp__chpl = &call_tmp_chpl;\r\n  chpl_build_bounded_range(INT64(1), INT64(10), ret_to_arg_ref_tmp__chpl);\r\n  ret_to_arg_ref_tmp__chpl2 = &call_tmp_chpl2;\r\n  chpl__buildDomainExpr(&call_tmp_chpl, ret_to_arg_ref_tmp__chpl2);\r\n  ret_chpl = call_tmp_chpl2;\r\n  ret_to_arg_ref_tmp__chpl3 = &default_argoffset_chpl;\r\n  createTuple_chpl(INT64(0), ret_to_arg_ref_tmp__chpl3);\r\n  this_chpl = ret_chpl;\r\n  ret__chpl = &((this_chpl)->ranges);\r\n  ret_x1_chpl = *(*(ret__chpl) + INT64(0));\r\n  _ic__F0_this_chpl = ret_x1_chpl;\r\n  ret_chpl2 = (&_ic__F0_this_chpl)->_low;\r\n  ret_chpl3 = (&_ic__F0_this_chpl)->_high;\r\n  end_chpl = ret_chpl3;\r\n  for (i_chpl = ret_chpl2; ((i_chpl <= end_chpl)); i_chpl += INT64(1)) {\r\n    writeln_chpl2(i_chpl);\r\n  }\r\n```\r\n\r\nand now it will generate:\r\n\r\n```c\r\n  _ic__F1_high_chpl = INT64(10);\r\n  for (i_chpl = INT64(1); ((i_chpl <= _ic__F1_high_chpl)); i_chpl += INT64(1)) {\r\n    writeln_chpl2(i_chpl);\r\n  }\r\n```","created_at":"2016-01-13T23:10:20Z","updated_at":"2016-01-13T23:34:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"13c97625f8748f891d77a5fd00e4831514245d1f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3105/commits","review_comments_url":"https://api.github.com/repos/chapel-lang/chapel/pulls/3105/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/3105/comments","statuses_url":"https://api.github.com/repos/chapel-lang/chapel/statuses/5d135efec137c03bd4bf788fe5748ad575f9242b","head":{"label":"ronawho:optimize-anonymous-domains","ref":"optimize-anonymous-domains","sha":"5d135efec137c03bd4bf788fe5748ad575f9242b","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}","created_at":"2014-07-16T16:46:31Z","updated_at":"2015-05-08T18:52:01Z","pushed_at":"2016-01-13T23:22:01Z","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":342149,"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":"b2ac6f3cf7c5ec56ead49a107eb2e2c65ba909f9","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}","created_at":"2014-07-09T18:15:54Z","updated_at":"2016-01-13T02:21:59Z","pushed_at":"2016-01-13T23:22:01Z","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":437141,"stargazers_count":194,"watchers_count":194,"language":"Chapel","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":64,"mirror_url":null,"open_issues_count":9,"forks":64,"open_issues":9,"watchers":194,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3105"},"html":{"href":"https://github.com/chapel-lang/chapel/pull/3105"},"issue":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/3105"},"comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/issues/3105/comments"},"review_comments":{"href":"https://api.github.com/repos/chapel-lang/chapel/pulls/3105/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/3105/commits"},"statuses":{"href":"https://api.github.com/repos/chapel-lang/chapel/statuses/5d135efec137c03bd4bf788fe5748ad575f9242b"}}}}