llvm.org GIT mirror llvm / 43eaade
Remove the "ugly" method BranchInst::setUnconditionalDest(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123026 91177308-0d34-0410-b5e6-96231b3b80d8 Jay Foad 9 years ago
2 changed file(s) with 0 addition(s) and 30 deletion(s). Raw diff Collapse all Expand all
20992099 Op<-3>() = V;
21002100 }
21012101
2102 // setUnconditionalDest - Change the current branch to an unconditional branch
2103 // targeting the specified block.
2104 // FIXME: Eliminate this ugly method.
2105 void setUnconditionalDest(BasicBlock *Dest) {
2106 Op<-1>() = (Value*)Dest;
2107 if (isConditional()) { // Convert this to an uncond branch.
2108 Op<-2>() = 0;
2109 Op<-3>() = 0;
2110 NumOperands = 1;
2111 OperandList = op_begin();
2112 }
2113 }
2114
21152102 unsigned getNumSuccessors() const { return 1+isConditional(); }
21162103
21172104 BasicBlock *getSuccessor(unsigned i) const {
9898
9999 EXPECT_EQ(b, b1->op_end());
100100
101 // shrink it
102 b1->setUnconditionalDest(bb1);
103
104 // check num operands
105 EXPECT_EQ(b1->getNumOperands(), 1U);
106
107 User::const_op_iterator c(b1->op_begin());
108 EXPECT_NE(c, b1->op_end());
109
110 // check THEN
111 EXPECT_EQ(*c, bb1);
112 EXPECT_EQ(b1->getOperand(0), bb1);
113 EXPECT_EQ(b1->getSuccessor(0), bb1);
114 ++c;
115
116 EXPECT_EQ(c, b1->op_end());
117
118101 // clean up
119102 delete b0;
120103 delete b1;