summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2017-12-29 19:25:53 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2017-12-29 19:25:53 +0000
commit0598347e4db4dfa506b9c7d15c17892db4a87cc0 (patch)
tree5c7cba3d824b84a1ab1a1a59bc23b5c111fb9a7c /unittests
parent6908779027330569d973493b476a2d37c1d6efeb (diff)
IR: Fix BasicBlock::phis for empty blocks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321567 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/IR/BasicBlockTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/IR/BasicBlockTest.cpp b/unittests/IR/BasicBlockTest.cpp
index f1777e35b82..08a41ff3693 100644
--- a/unittests/IR/BasicBlockTest.cpp
+++ b/unittests/IR/BasicBlockTest.cpp
@@ -33,6 +33,12 @@ TEST(BasicBlockTest, PhiRange) {
std::unique_ptr<BasicBlock> BB2(BasicBlock::Create(Context));
BranchInst::Create(BB.get(), BB2.get());
+ // Make sure this doesn't crash if there are no phis.
+ for (auto &PN : BB->phis()) {
+ (void)PN;
+ EXPECT_TRUE(false) << "empty block should have no phis";
+ }
+
// Make it a cycle.
auto *BI = BranchInst::Create(BB.get(), BB.get());