llvm.org GIT mirror llvm / 0598347
IR: Fix BasicBlock::phis for empty blocks git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321567 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 2 years ago
2 changed file(s) with 8 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
263263 }
264264
265265 iterator_range BasicBlock::phis() {
266 return make_range(dyn_cast(&front()), nullptr);
266 PHINode *P = empty() ? nullptr : dyn_cast(&*begin());
267 return make_range(P, nullptr);
267268 }
268269
269270 /// This method is used to notify a BasicBlock that the
3131 BranchInst::Create(BB.get(), BB1.get());
3232 std::unique_ptr BB2(BasicBlock::Create(Context));
3333 BranchInst::Create(BB.get(), BB2.get());
34
35 // Make sure this doesn't crash if there are no phis.
36 for (auto &PN : BB->phis()) {
37 (void)PN;
38 EXPECT_TRUE(false) << "empty block should have no phis";
39 }
3440
3541 // Make it a cycle.
3642 auto *BI = BranchInst::Create(BB.get(), BB.get());