[llvm-branch-commits] [llvm] [InstCombine] Enable select freeze poison folding when storing value (PR #129776)
John McIver via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Mar 5 21:02:45 PST 2025
================
@@ -4813,15 +4813,22 @@ Instruction *InstCombinerImpl::visitFreeze(FreezeInst &I) {
// TODO: This could use getBinopAbsorber() / getBinopIdentity() to avoid
// duplicating logic for binops at least.
auto getUndefReplacement = [&I](Type *Ty) {
- Constant *BestValue = nullptr;
- Constant *NullValue = Constant::getNullValue(Ty);
+ Value *BestValue = nullptr;
+ Value *NullValue = Constant::getNullValue(Ty);
for (const auto *U : I.users()) {
- Constant *C = NullValue;
+ Value *C = NullValue;
if (match(U, m_Or(m_Value(), m_Value())))
C = ConstantInt::getAllOnesValue(Ty);
else if (match(U, m_Select(m_Specific(&I), m_Constant(), m_Value())))
C = ConstantInt::getTrue(Ty);
-
+ else if (I.hasOneUse() &&
----------------
jmciver wrote:
Good point! I'll fix this as well.
https://github.com/llvm/llvm-project/pull/129776
More information about the llvm-branch-commits
mailing list