[llvm] [Bitcode] Fix constexpr expansion creating invalid PHIs (PR #141560)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue May 27 04:10:22 PDT 2025
================
@@ -6095,14 +6095,18 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
// seen value here, to avoid expanding a constant expression multiple
// times.
auto It = Args.find(BB);
+ BasicBlock *EdgeBB = ConstExprEdgeBBs.lookup({BB, CurBB});
if (It != Args.end()) {
- PN->addIncoming(It->second, BB);
+ /// If this predecessor was also replaced with a constexpr basic
+ /// block, it must be de-duplicated.
+ if (!EdgeBB) {
+ PN->addIncoming(It->second, BB);
+ }
----------------
nikic wrote:
```suggestion
// If this predecessor was also replaced with a constexpr basic
// block, it must be de-duplicated.
if (!EdgeBB)
PN->addIncoming(It->second, BB);
```
https://github.com/llvm/llvm-project/pull/141560
More information about the llvm-commits
mailing list