[LLVMdev] [llvm-commits] SSI Patch

Nick Lewycky nicholas at mxc.ca
Tue Sep 1 20:55:50 PDT 2009


Andre Tavares wrote:
> I tried to make 5 separate patches, but as they are constructive, they 
> had information from the last one. So I will post one by one as it gets 
> on the tree.
> 
> 1. We had a function isUsedInTerminator that tested if a comparator was 
> used in the terminator of its parent BasicBlock. This is wrong because a 
> comparator can be created in a BasicBlock and used in the terminator of 
> other BasicBlock, and can be used in more than one.

+            for (unsigned j = 0, e = TI->getNumSuccessors(); j < e; ++j) {
+              // Next Basic Block
+              BasicBlock *BB_next = TI->getSuccessor(j);
+              if (BB_next != BB &&
+                  BB_next->getSinglePredecessor() != NULL &&
+                  dominateAny(BB_next, value[i])) {
+                PHINode *PN = PHINode::Create(
+                    value[i]->getType(), SSI_SIG, BB_next->begin());
+                PN->addIncoming(value[i], BB);
+                sigmas.insert(std::make_pair(PN, i));
+                created.insert(PN);
+                need = true;
+                defsites[i].push_back(BB_next);
+                ++NumSigmaInserted;
+              }
+            }

Please break this out into its own method. Otherwise, this looks fine to me.

Nick



More information about the llvm-dev mailing list