[llvm] r257086 - [DominatorTree] Remove unnecessary map population. NFC.

Liao, Michael via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 7 11:48:30 PST 2016


I have no idea what the previous issue is exactly is. That code is added really long ago and it’s moved/renamed to several files and hardly to trace back. Based on the so-far code, that population is not necessary as the construction itself doesn’t iterate on those maps and populate these maps only when necessary. I don’t see any reason the iteration could be invalidated otherwise once the (post)domtree is constructed. Also, that population is enabled during post-domtree construction only based on the previous code, which doesn’t make sense.

Thanks
- Michael

From: Daniel Berlin [mailto:dberlin at dberlin.org]
Sent: Thursday, January 7, 2016 11:28 AM
To: Liao, Michael <michael.liao at intel.com>
Cc: llvm-commits <llvm-commits at lists.llvm.org>
Subject: Re: [llvm] r257086 - [DominatorTree] Remove unnecessary map population. NFC.

Can you explain a little bit more?

IE what the issue was before you think no longer exists anymore?

On Thu, Jan 7, 2016 at 11:21 AM, Michael Liao via llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> wrote:
Author: hliao
Date: Thu Jan  7 13:21:29 2016
New Revision: 257086

URL: http://llvm.org/viewvc/llvm-project?rev=257086&view=rev
Log:
[DominatorTree] Remove unnecessary map population. NFC.

- The reason of population these maps seems not valid any more.


Modified:
    llvm/trunk/include/llvm/Support/GenericDomTree.h

Modified: llvm/trunk/include/llvm/Support/GenericDomTree.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GenericDomTree.h?rev=257086&r1=257085&r2=257086&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/GenericDomTree.h (original)
+++ llvm/trunk/include/llvm/Support/GenericDomTree.h Thu Jan  7 13:21:29 2016
@@ -724,25 +724,17 @@ public:
     if (!this->IsPostDominators) {
       // Initialize root
       NodeT *entry = TraitsTy::getEntryNode(&F);
-      this->Roots.push_back(entry);
-      this->IDoms[entry] = nullptr;
-      this->DomTreeNodes[entry] = nullptr;
+      addRoot(entry);

       Calculate<FT, NodeT *>(*this, F);
     } else {
       // Initialize the roots list
       for (typename TraitsTy::nodes_iterator I = TraitsTy::nodes_begin(&F),
                                              E = TraitsTy::nodes_end(&F);
-           I != E; ++I) {
+           I != E; ++I)
         if (TraitsTy::child_begin(&*I) == TraitsTy::child_end(&*I))
           addRoot(&*I);

-        // Prepopulate maps so that we don't get iterator invalidation issues
-        // later.
-        this->IDoms[&*I] = nullptr;
-        this->DomTreeNodes[&*I] = nullptr;
-      }
-
       Calculate<FT, Inverse<NodeT *>>(*this, F);
     }
   }


_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160107/aee2592f/attachment.html>


More information about the llvm-commits mailing list