This is an archive of the discontinued LLVM Phabricator instance.

IR: Fix BasicBlock::phis for empty blocks
ClosedPublic

Authored by arsenm on Dec 19 2017, 3:37 PM.

Details

Reviewers
dberlin

Diff Detail

Event Timeline

arsenm created this revision.Dec 19 2017, 3:37 PM
dberlin accepted this revision.Dec 28 2017, 6:26 PM
dberlin added a subscriber: dberlin.
dberlin added inline comments.
lib/IR/BasicBlock.cpp
267

I would just use

// PHINodes, if they exist, come first in the block
PHINode *P = empty() ? nullptr : dyn_cast<PHINode>(&*begin())
This revision is now accepted and ready to land.Dec 28 2017, 6:26 PM
davide added a subscriber: davide.Dec 29 2017, 2:49 AM

Can you add a unittest to show this issue?

arsenm closed this revision.Dec 29 2017, 11:27 AM
arsenm marked an inline comment as done.

r321567