Skip to content

Commit 68309ad

Browse files
authored
[NFC] Clean up poison folding in simplifyBinaryIntrinsic (#147259)
Fixes #147116.
1 parent 8ae8d31 commit 68309ad

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

llvm/lib/Analysis/InstructionSimplify.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6484,9 +6484,6 @@ Value *llvm::simplifyBinaryIntrinsic(Intrinsic::ID IID, Type *ReturnType,
64846484
break;
64856485
}
64866486
case Intrinsic::ptrmask: {
6487-
if (isa<PoisonValue>(Op0) || isa<PoisonValue>(Op1))
6488-
return PoisonValue::get(Op0->getType());
6489-
64906487
// NOTE: We can't apply this simplifications based on the value of Op1
64916488
// because we need to preserve provenance.
64926489
if (Q.isUndefValue(Op0) || match(Op0, m_Zero()))
@@ -6533,10 +6530,6 @@ Value *llvm::simplifyBinaryIntrinsic(Intrinsic::ID IID, Type *ReturnType,
65336530
if (match(Op0, m_ImmConstant()))
65346531
std::swap(Op0, Op1);
65356532

6536-
// Propagate poison.
6537-
if (isa<PoisonValue>(Op1))
6538-
return Op1;
6539-
65406533
// Assume undef is the limit value.
65416534
if (Q.isUndefValue(Op1))
65426535
return ConstantInt::get(
@@ -6696,9 +6689,6 @@ Value *llvm::simplifyBinaryIntrinsic(Intrinsic::ID IID, Type *ReturnType,
66966689
return Op1;
66976690
break;
66986691
case Intrinsic::is_fpclass: {
6699-
if (isa<PoisonValue>(Op0))
6700-
return PoisonValue::get(ReturnType);
6701-
67026692
uint64_t Mask = cast<ConstantInt>(Op1)->getZExtValue();
67036693
// If all tests are made, it doesn't matter what the value is.
67046694
if ((Mask & fcAllFlags) == fcAllFlags)

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7899,6 +7899,8 @@ bool llvm::intrinsicPropagatesPoison(Intrinsic::ID IID) {
78997899
case Intrinsic::umax:
79007900
case Intrinsic::umin:
79017901
case Intrinsic::scmp:
7902+
case Intrinsic::is_fpclass:
7903+
case Intrinsic::ptrmask:
79027904
case Intrinsic::ucmp:
79037905
case Intrinsic::bitreverse:
79047906
case Intrinsic::bswap:

0 commit comments

Comments
 (0)