summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/IR
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
commit344c09202b0450c696da6950a59775d2ee96f28d (patch)
tree635387f60ab3bde31e7c9ca00120bc734e99f40b /llvm/unittests/IR
parentd41feef40f5fa4e7bdb77adea7c856157758db15 (diff)
downloadbcm5719-llvm-344c09202b0450c696da6950a59775d2ee96f28d.tar.gz
bcm5719-llvm-344c09202b0450c696da6950a59775d2ee96f28d.zip
IR: Fix BasicBlock::phis for empty blocks
llvm-svn: 321567
Diffstat (limited to 'llvm/unittests/IR')
-rw-r--r--llvm/unittests/IR/BasicBlockTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/unittests/IR/BasicBlockTest.cpp b/llvm/unittests/IR/BasicBlockTest.cpp
index f1777e35b82..08a41ff3693 100644
--- a/llvm/unittests/IR/BasicBlockTest.cpp
+++ b/llvm/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());
OpenPOWER on IntegriCloud