[llvm-commits] SSI Patch

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.

Patch attached

Andre Tavares wrote:

ssi1.patch (3.46 KB)

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