[llvm] [Attributor] Propagate alignment through ptrmask (PR #150158)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 14 20:50:01 PDT 2025
================
@@ -5187,6 +5187,33 @@ struct AADereferenceableCallSiteReturned final
// ------------------------ Align Argument Attribute ------------------------
namespace {
+
+Align getAssumedAlignForIntrinsic(Attributor &A, AAAlign &QueryingAA,
+ const IntrinsicInst &II) {
+ Align Alignment;
+ switch (II.getIntrinsicID()) {
+ case Intrinsic::ptrmask: {
+ const auto *ConstVals = A.getAAFor<AAPotentialConstantValues>(
+ QueryingAA, IRPosition::value(*II.getOperand(1)), DepClassTy::REQUIRED);
+ const auto *AlignAA =
+ A.getAAFor<AAAlign>(QueryingAA, IRPosition::value(*(II.getOperand(0))),
+ DepClassTy::REQUIRED);
+ if (ConstVals && ConstVals->isValidState()) {
+ unsigned ShiftValue =
+ std::min(ConstVals->getAssumedMinTrailingZeros(), 63U);
----------------
shiltian wrote:
Do we want to use `Value::MaxAlignmentExponent` here as well?
https://github.com/llvm/llvm-project/pull/150158
More information about the llvm-commits
mailing list