| Issue |
114796
|
| Summary |
[Verifier] Duplicated Predecessors of BasicBlock can pass verifier
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
x14ngch3n
|
IR below is generated with LLVM-3.6, this BB (block_1645788) has three duplicated predecessors (block_1645730) and its PHINode has three duplicated incoming values ( [ %tmp41218, %block_1645730 ] ). This BB is actually a switch case, and the duplicated predecessors are where the SwitchInst is located, the duplicated predecessors is because different cases fall through the same block.
```llvm
block_1645788: ; preds = %bb31747, %block_164577c, %block_1645730, %block_1645730, %block_1645730
%tmp41324 = phi i64 [ %tmp31748, %bb31747 ], [ %tmp41323, %block_164577c ], [ %tmp41218, %block_1645730 ], [ %tmp41218, %block_1645730 ], [ %tmp41218, %block_1645730 ], !asm !165
%tmp41325 = phi i64 [ %tmp41318, %bb31747 ], [ %tmp41318, %block_164577c ], [ %tmp31712, %block_1645730 ], [ %tmp31712, %block_1645730 ], [ %tmp31712, %block_1645730 ], !asm !165
%tmp41326 = phi i64 [ %tmp41319, %bb31747 ], [ %tmp41319, %block_164577c ], [ %tmp41105, %block_1645730 ], [ %tmp41105, %block_1645730 ], [ %tmp41105, %block_1645730 ], !asm !165
br label %block_164578c, !asm !166
```
To compare, in the latest LLVM/Clang, the compiler will not generate BB with duplicated predecessors: https://godbolt.org/z/Pxond9x47
*I don't understand why this IR can pass the verifier? Why not just keep one predecessors? * In other words, when can we assume that PHI Node can only have incoming values from distinct incoming blocks (predecessors)?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs