[clang] [InstCombine] Add combines/simplifications for `llvm.ptrmask` (PR #67166)
Alexander Richardson via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 27 09:00:52 PDT 2023
================
@@ -6411,6 +6411,40 @@ static Value *simplifyBinaryIntrinsic(Function *F, Value *Op0, Value *Op1,
return Constant::getNullValue(ReturnType);
break;
}
+ case Intrinsic::ptrmask: {
+ if (isa<PoisonValue>(Op0) || isa<PoisonValue>(Op1))
+ return PoisonValue::get(Op0->getType());
+
+ // NOTE: We can't apply this simplifications based on the value of Op1
+ // because we need to preserve provenance.
+ if (Q.isUndefValue(Op0) || match(Op0, m_Zero()))
+ return Constant::getNullValue(Op0->getType());
+
+ if (Op1->getType()->getScalarSizeInBits() ==
----------------
arichardson wrote:
I believe this branch can be replaced with assert(Op1->getType()->getScalarSizeInBits() == Q.DL.getPointerIndexSizeInBits(Op0->getType()) since the verified now ensures the argument matches the index size since #69343
https://github.com/llvm/llvm-project/pull/67166
More information about the cfe-commits
mailing list