mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Disallow cond_br with identical destinations.
It avoids generation of llvm phi nodes with identical predecessors and differing values. This change replaces my previous fix of this problem in r23580, where I handled it in IRGen. There were some discussions about it with the conclusion that it's better to just disallow such cond_br instructions in SIL. It makes the life easier for some SIL optimizations which can't deal with cond_br with identical destinations. The original radar is <rdar://problem/18568272> Swift compiler fails with "PHI node has multiple entries for the same basic block with different incoming values!" Swift SVN r23861
This commit is contained in:
@@ -2118,6 +2118,8 @@ public:
|
||||
|
||||
require(CBI->getTrueArgs().size() == CBI->getTrueBB()->bbarg_size(),
|
||||
"true branch has wrong number of arguments for dest bb");
|
||||
require(CBI->getTrueBB() != CBI->getFalseBB(),
|
||||
"identical destinations");
|
||||
require(std::equal(CBI->getTrueArgs().begin(), CBI->getTrueArgs().end(),
|
||||
CBI->getTrueBB()->bbarg_begin(),
|
||||
[](SILValue branchArg, SILArgument *bbArg) {
|
||||
|
||||
Reference in New Issue
Block a user