[llvm] [InstSimplify] Fix Inconsistent PHI Simplification (PR #113037)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 19 07:31:04 PDT 2024
================
@@ -5309,20 +5357,18 @@ static Value *simplifyPHINode(PHINode *PN, ArrayRef<Value *> IncomingValues,
continue;
}
if (Q.isUndefValue(Incoming)) {
- // Remember that we saw an undef value, but otherwise ignore them.
+ // Remember that we saw an undef value.
HasUndefInput = true;
- continue;
}
- if (CommonValue && Incoming != CommonValue)
+ CommonValue = getCommonPHIValue(CommonValue, Incoming, Q);
+ if (!CommonValue)
return nullptr; // Not the same, bail out.
- CommonValue = Incoming;
}
- // If CommonValue is null then all of the incoming values were either undef,
- // poison or equal to the phi node itself.
+ // If CommonValue is null then all of the incoming values were either poison
+ // or equal to the phi node itself.
if (!CommonValue)
- return HasUndefInput ? UndefValue::get(PN->getType())
- : PoisonValue::get(PN->getType());
+ return PoisonValue::get(PN->getType());
----------------
goldsteinn wrote:
Is this not turning `undef` into `poison` in some cases?
https://github.com/llvm/llvm-project/pull/113037
More information about the llvm-commits
mailing list