{"action":"created","comment":{"url":"https://api.github.com/repos/ldc-developers/ldc/pulls/comments/329349636","pull_request_review_id":294679488,"id":329349636,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyOTM0OTYzNg==","diff_hunk":"@@ -285,9 +315,21 @@ class ToIRVisitor : public Visitor {\n     }\n   }\n \n+  //////////////////////////////////////////////////////////////////////////\n+\n+  bool containsLabel(Statement *stmt) {\n+    if (!stmt)\n+      return false;\n+    ContainsLabel labelChecker;\n+    ExtendedRecursiveWalker walker(&labelChecker, false);\n+    stmt->accept(&walker);\n+    return labelChecker.foundLabel();\n+  }\n+\n+  //////////////////////////////////////////////////////////////////////////\n+\n   void visit(IfStatement *stmt) override {\n     IF_LOG Logger::println(\"IfStatement::toIR(): %s\", stmt->loc.toChars());\n-    LOG_SCOPE;","path":"gen/statements.cpp","position":63,"original_position":63,"commit_id":"0206e47d645e0d95823385527d57b147c5af4336","original_commit_id":"0206e47d645e0d95823385527d57b147c5af4336","user":{"login":"baziotis","id":25438563,"node_id":"MDQ6VXNlcjI1NDM4NTYz","avatar_url":"https://avatars1.githubusercontent.com/u/25438563?v=4","gravatar_id":"","url":"https://api.github.com/users/baziotis","html_url":"https://github.com/baziotis","followers_url":"https://api.github.com/users/baziotis/followers","following_url":"https://api.github.com/users/baziotis/following{/other_user}","gists_url":"https://api.github.com/users/baziotis/gists{/gist_id}","starred_url":"https://api.github.com/users/baziotis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baziotis/subscriptions","organizations_url":"https://api.github.com/users/baziotis/orgs","repos_url":"https://api.github.com/users/baziotis/repos","events_url":"https://api.github.com/users/baziotis/events{/privacy}","received_events_url":"https://api.github.com/users/baziotis/received_events","type":"User","site_admin":false},"body":"Ah, I get it yes. Btw, sorry, with current I meant this PR's current output, not upstream current output. So the problem is not that `Constant true/false condition - elide`, it's that in this PR, e.g. `VarExp` is not indented. I think that to fix this, one `LOG_SCOPE` has to be added where it is now. And another outside (and after) the block that deals with constant expressions (the `if (LLConstant ...)`.","created_at":"2019-09-29T11:14:33Z","updated_at":"2019-09-29T11:14:33Z","html_url":"https://github.com/ldc-developers/ldc/pull/3134#discussion_r329349636","pull_request_url":"https://api.github.com/repos/ldc-developers/ldc/pulls/3134","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/comments/329349636"},"html":{"href":"https://github.com/ldc-developers/ldc/pull/3134#discussion_r329349636"},"pull_request":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/3134"}},"in_reply_to_id":329327847},"pull_request":{"url":"https://api.github.com/repos/ldc-developers/ldc/pulls/3134","id":307857320,"node_id":"MDExOlB1bGxSZXF1ZXN0MzA3ODU3MzIw","html_url":"https://github.com/ldc-developers/ldc/pull/3134","diff_url":"https://github.com/ldc-developers/ldc/pull/3134.diff","patch_url":"https://github.com/ldc-developers/ldc/pull/3134.patch","issue_url":"https://api.github.com/repos/ldc-developers/ldc/issues/3134","number":3134,"state":"open","locked":false,"title":"[WIP] Disable dead code when an if/else if condition is constant","user":{"login":"baziotis","id":25438563,"node_id":"MDQ6VXNlcjI1NDM4NTYz","avatar_url":"https://avatars1.githubusercontent.com/u/25438563?v=4","gravatar_id":"","url":"https://api.github.com/users/baziotis","html_url":"https://github.com/baziotis","followers_url":"https://api.github.com/users/baziotis/followers","following_url":"https://api.github.com/users/baziotis/following{/other_user}","gists_url":"https://api.github.com/users/baziotis/gists{/gist_id}","starred_url":"https://api.github.com/users/baziotis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baziotis/subscriptions","organizations_url":"https://api.github.com/users/baziotis/orgs","repos_url":"https://api.github.com/users/baziotis/repos","events_url":"https://api.github.com/users/baziotis/events{/privacy}","received_events_url":"https://api.github.com/users/baziotis/received_events","type":"User","site_admin":false},"body":"A more specific PR, result of a previous: https://github.com/ldc-developers/ldc/pull/3133\r\nIssue: https://github.com/ldc-developers/ldc/issues/2344\r\n\r\nAlthough @JohanEngelen you proposed that I focus on `if (0)` on this PR, when I wrote this, `if (1)` had exactly the same logic and seemed like it fit quite nicely. I can remove it though. \r\n\r\n-- Doesn't take into consideration labels.\r\n\r\nThe comments in the previous PR are worth a look. The tl;dr is:\r\n- A discussion about labels.\r\n- @JohanEngelen proposed that I take a look at how other compilers (DMD, GDC and Clang) handle this.\r\n\r\nRegarding the last one, I had no hope with DMD. I did spend some time and I could not even target where an if statement (or such) is handled.\r\n\r\nLastly, I don't quite get `insertBB` and `irs->DBuilder`. I know what a basic block is and that the DBuilder has to do with debug info. But I don't understand exactly how they are used, when etc.\r\n\r\nEdit: I should probably add a `delete cond_e` as it is done in e.g. (WhileStatement](https://github.com/ldc-developers/ldc/blob/master/gen/statements.cpp#L410). Probably was missed by accident here.","created_at":"2019-08-15T21:03:31Z","updated_at":"2019-09-29T11:14:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b03bdec49681076d8ead2a511ca992f9f8a876c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ldc-developers/ldc/pulls/3134/commits","review_comments_url":"https://api.github.com/repos/ldc-developers/ldc/pulls/3134/comments","review_comment_url":"https://api.github.com/repos/ldc-developers/ldc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ldc-developers/ldc/issues/3134/comments","statuses_url":"https://api.github.com/repos/ldc-developers/ldc/statuses/0206e47d645e0d95823385527d57b147c5af4336","head":{"label":"baziotis:if_false2","ref":"if_false2","sha":"0206e47d645e0d95823385527d57b147c5af4336","user":{"login":"baziotis","id":25438563,"node_id":"MDQ6VXNlcjI1NDM4NTYz","avatar_url":"https://avatars1.githubusercontent.com/u/25438563?v=4","gravatar_id":"","url":"https://api.github.com/users/baziotis","html_url":"https://github.com/baziotis","followers_url":"https://api.github.com/users/baziotis/followers","following_url":"https://api.github.com/users/baziotis/following{/other_user}","gists_url":"https://api.github.com/users/baziotis/gists{/gist_id}","starred_url":"https://api.github.com/users/baziotis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baziotis/subscriptions","organizations_url":"https://api.github.com/users/baziotis/orgs","repos_url":"https://api.github.com/users/baziotis/repos","events_url":"https://api.github.com/users/baziotis/events{/privacy}","received_events_url":"https://api.github.com/users/baziotis/received_events","type":"User","site_admin":false},"repo":{"id":201693555,"node_id":"MDEwOlJlcG9zaXRvcnkyMDE2OTM1NTU=","name":"ldc","full_name":"baziotis/ldc","private":false,"owner":{"login":"baziotis","id":25438563,"node_id":"MDQ6VXNlcjI1NDM4NTYz","avatar_url":"https://avatars1.githubusercontent.com/u/25438563?v=4","gravatar_id":"","url":"https://api.github.com/users/baziotis","html_url":"https://github.com/baziotis","followers_url":"https://api.github.com/users/baziotis/followers","following_url":"https://api.github.com/users/baziotis/following{/other_user}","gists_url":"https://api.github.com/users/baziotis/gists{/gist_id}","starred_url":"https://api.github.com/users/baziotis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baziotis/subscriptions","organizations_url":"https://api.github.com/users/baziotis/orgs","repos_url":"https://api.github.com/users/baziotis/repos","events_url":"https://api.github.com/users/baziotis/events{/privacy}","received_events_url":"https://api.github.com/users/baziotis/received_events","type":"User","site_admin":false},"html_url":"https://github.com/baziotis/ldc","description":"The LLVM-based D Compiler.","fork":true,"url":"https://api.github.com/repos/baziotis/ldc","forks_url":"https://api.github.com/repos/baziotis/ldc/forks","keys_url":"https://api.github.com/repos/baziotis/ldc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/baziotis/ldc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/baziotis/ldc/teams","hooks_url":"https://api.github.com/repos/baziotis/ldc/hooks","issue_events_url":"https://api.github.com/repos/baziotis/ldc/issues/events{/number}","events_url":"https://api.github.com/repos/baziotis/ldc/events","assignees_url":"https://api.github.com/repos/baziotis/ldc/assignees{/user}","branches_url":"https://api.github.com/repos/baziotis/ldc/branches{/branch}","tags_url":"https://api.github.com/repos/baziotis/ldc/tags","blobs_url":"https://api.github.com/repos/baziotis/ldc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/baziotis/ldc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/baziotis/ldc/git/refs{/sha}","trees_url":"https://api.github.com/repos/baziotis/ldc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/baziotis/ldc/statuses/{sha}","languages_url":"https://api.github.com/repos/baziotis/ldc/languages","stargazers_url":"https://api.github.com/repos/baziotis/ldc/stargazers","contributors_url":"https://api.github.com/repos/baziotis/ldc/contributors","subscribers_url":"https://api.github.com/repos/baziotis/ldc/subscribers","subscription_url":"https://api.github.com/repos/baziotis/ldc/subscription","commits_url":"https://api.github.com/repos/baziotis/ldc/commits{/sha}","git_commits_url":"https://api.github.com/repos/baziotis/ldc/git/commits{/sha}","comments_url":"https://api.github.com/repos/baziotis/ldc/comments{/number}","issue_comment_url":"https://api.github.com/repos/baziotis/ldc/issues/comments{/number}","contents_url":"https://api.github.com/repos/baziotis/ldc/contents/{+path}","compare_url":"https://api.github.com/repos/baziotis/ldc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/baziotis/ldc/merges","archive_url":"https://api.github.com/repos/baziotis/ldc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/baziotis/ldc/downloads","issues_url":"https://api.github.com/repos/baziotis/ldc/issues{/number}","pulls_url":"https://api.github.com/repos/baziotis/ldc/pulls{/number}","milestones_url":"https://api.github.com/repos/baziotis/ldc/milestones{/number}","notifications_url":"https://api.github.com/repos/baziotis/ldc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/baziotis/ldc/labels{/name}","releases_url":"https://api.github.com/repos/baziotis/ldc/releases{/id}","deployments_url":"https://api.github.com/repos/baziotis/ldc/deployments","created_at":"2019-08-10T23:26:40Z","updated_at":"2019-09-10T11:19:11Z","pushed_at":"2019-09-28T21:02:27Z","git_url":"git://github.com/baziotis/ldc.git","ssh_url":"git@github.com:baziotis/ldc.git","clone_url":"https://github.com/baziotis/ldc.git","svn_url":"https://github.com/baziotis/ldc","homepage":"http://wiki.dlang.org/LDC","size":33019,"stargazers_count":0,"watchers_count":0,"language":"D","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ldc-developers:master","ref":"master","sha":"af4ffaf04aedd1cc12f8b456b6a4b1cf8db6479c","user":{"login":"ldc-developers","id":960112,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk2MDExMg==","avatar_url":"https://avatars2.githubusercontent.com/u/960112?v=4","gravatar_id":"","url":"https://api.github.com/users/ldc-developers","html_url":"https://github.com/ldc-developers","followers_url":"https://api.github.com/users/ldc-developers/followers","following_url":"https://api.github.com/users/ldc-developers/following{/other_user}","gists_url":"https://api.github.com/users/ldc-developers/gists{/gist_id}","starred_url":"https://api.github.com/users/ldc-developers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ldc-developers/subscriptions","organizations_url":"https://api.github.com/users/ldc-developers/orgs","repos_url":"https://api.github.com/users/ldc-developers/repos","events_url":"https://api.github.com/users/ldc-developers/events{/privacy}","received_events_url":"https://api.github.com/users/ldc-developers/received_events","type":"Organization","site_admin":false},"repo":{"id":2174666,"node_id":"MDEwOlJlcG9zaXRvcnkyMTc0NjY2","name":"ldc","full_name":"ldc-developers/ldc","private":false,"owner":{"login":"ldc-developers","id":960112,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk2MDExMg==","avatar_url":"https://avatars2.githubusercontent.com/u/960112?v=4","gravatar_id":"","url":"https://api.github.com/users/ldc-developers","html_url":"https://github.com/ldc-developers","followers_url":"https://api.github.com/users/ldc-developers/followers","following_url":"https://api.github.com/users/ldc-developers/following{/other_user}","gists_url":"https://api.github.com/users/ldc-developers/gists{/gist_id}","starred_url":"https://api.github.com/users/ldc-developers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ldc-developers/subscriptions","organizations_url":"https://api.github.com/users/ldc-developers/orgs","repos_url":"https://api.github.com/users/ldc-developers/repos","events_url":"https://api.github.com/users/ldc-developers/events{/privacy}","received_events_url":"https://api.github.com/users/ldc-developers/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ldc-developers/ldc","description":"The LLVM-based D Compiler.","fork":false,"url":"https://api.github.com/repos/ldc-developers/ldc","forks_url":"https://api.github.com/repos/ldc-developers/ldc/forks","keys_url":"https://api.github.com/repos/ldc-developers/ldc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ldc-developers/ldc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ldc-developers/ldc/teams","hooks_url":"https://api.github.com/repos/ldc-developers/ldc/hooks","issue_events_url":"https://api.github.com/repos/ldc-developers/ldc/issues/events{/number}","events_url":"https://api.github.com/repos/ldc-developers/ldc/events","assignees_url":"https://api.github.com/repos/ldc-developers/ldc/assignees{/user}","branches_url":"https://api.github.com/repos/ldc-developers/ldc/branches{/branch}","tags_url":"https://api.github.com/repos/ldc-developers/ldc/tags","blobs_url":"https://api.github.com/repos/ldc-developers/ldc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ldc-developers/ldc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ldc-developers/ldc/git/refs{/sha}","trees_url":"https://api.github.com/repos/ldc-developers/ldc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ldc-developers/ldc/statuses/{sha}","languages_url":"https://api.github.com/repos/ldc-developers/ldc/languages","stargazers_url":"https://api.github.com/repos/ldc-developers/ldc/stargazers","contributors_url":"https://api.github.com/repos/ldc-developers/ldc/contributors","subscribers_url":"https://api.github.com/repos/ldc-developers/ldc/subscribers","subscription_url":"https://api.github.com/repos/ldc-developers/ldc/subscription","commits_url":"https://api.github.com/repos/ldc-developers/ldc/commits{/sha}","git_commits_url":"https://api.github.com/repos/ldc-developers/ldc/git/commits{/sha}","comments_url":"https://api.github.com/repos/ldc-developers/ldc/comments{/number}","issue_comment_url":"https://api.github.com/repos/ldc-developers/ldc/issues/comments{/number}","contents_url":"https://api.github.com/repos/ldc-developers/ldc/contents/{+path}","compare_url":"https://api.github.com/repos/ldc-developers/ldc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ldc-developers/ldc/merges","archive_url":"https://api.github.com/repos/ldc-developers/ldc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ldc-developers/ldc/downloads","issues_url":"https://api.github.com/repos/ldc-developers/ldc/issues{/number}","pulls_url":"https://api.github.com/repos/ldc-developers/ldc/pulls{/number}","milestones_url":"https://api.github.com/repos/ldc-developers/ldc/milestones{/number}","notifications_url":"https://api.github.com/repos/ldc-developers/ldc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ldc-developers/ldc/labels{/name}","releases_url":"https://api.github.com/repos/ldc-developers/ldc/releases{/id}","deployments_url":"https://api.github.com/repos/ldc-developers/ldc/deployments","created_at":"2011-08-08T17:10:27Z","updated_at":"2019-09-25T22:30:30Z","pushed_at":"2019-09-28T22:33:28Z","git_url":"git://github.com/ldc-developers/ldc.git","ssh_url":"git@github.com:ldc-developers/ldc.git","clone_url":"https://github.com/ldc-developers/ldc.git","svn_url":"https://github.com/ldc-developers/ldc","homepage":"http://wiki.dlang.org/LDC","size":32974,"stargazers_count":818,"watchers_count":818,"language":"D","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":176,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":307,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":176,"open_issues":307,"watchers":818,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/3134"},"html":{"href":"https://github.com/ldc-developers/ldc/pull/3134"},"issue":{"href":"https://api.github.com/repos/ldc-developers/ldc/issues/3134"},"comments":{"href":"https://api.github.com/repos/ldc-developers/ldc/issues/3134/comments"},"review_comments":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/3134/comments"},"review_comment":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/3134/commits"},"statuses":{"href":"https://api.github.com/repos/ldc-developers/ldc/statuses/0206e47d645e0d95823385527d57b147c5af4336"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"baziotis"}}