[polly] r214170 - Assume no annotations when visiting new domain (IslAst)

Johannes Doerfert jdoerfert at codeaurora.org
Tue Jul 29 01:59:56 PDT 2014


Author: jdoerfert
Date: Tue Jul 29 03:59:56 2014
New Revision: 214170

URL: http://llvm.org/viewvc/llvm-project?rev=214170&view=rev
Log:
Assume no annotations when visiting new domain (IslAst)

  Whe we build the IslAst we visit for nodes (in pre and post order) as well as
  user/domain nodes. As these two sets are non overlapping we do not need to
  check if we annotated a node earlier when we visit it.


Modified:
    polly/trunk/lib/CodeGen/IslAst.cpp

Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=214170&r1=214169&r2=214170&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Tue Jul 29 03:59:56 2014
@@ -239,22 +239,12 @@ astBuildAfterFor(__isl_take isl_ast_node
 static __isl_give isl_ast_node *AtEachDomain(__isl_take isl_ast_node *Node,
                                              __isl_keep isl_ast_build *Build,
                                              void *User) {
-  IslAstUserPayload *Info = nullptr;
-  isl_id *Id = isl_ast_node_get_annotation(Node);
+  assert(!isl_ast_node_get_annotation(Node) && "Node already annotated");
+  IslAstUserPayload *NodeInfo = new IslAstUserPayload();
+  isl_id *Id = isl_id_alloc(isl_ast_build_get_ctx(Build), "", NodeInfo);
+  Id = isl_id_set_free_user(Id, freeIslAstUserPayload);
 
-  if (Id)
-    Info = (IslAstUserPayload *)isl_id_get_user(Id);
-
-  if (!Info) {
-    // Allocate annotations once: parallel for detection might have already
-    // allocated the annotations for this node.
-    Info = new IslAstUserPayload();
-    Id = isl_id_alloc(isl_ast_node_get_ctx(Node), nullptr, Info);
-    Id = isl_id_set_free_user(Id, freeIslAstUserPayload);
-  }
-
-  if (!Info->Build)
-    Info->Build = isl_ast_build_copy(Build);
+  NodeInfo->Build = isl_ast_build_copy(Build);
 
   return isl_ast_node_set_annotation(Node, Id);
 }





More information about the llvm-commits mailing list