[llvm] [VPlan] Also expand pointer-typed SCEVAddExpr in VPSCEVExpander. (PR #206366)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 29 05:31:19 PDT 2026
================
@@ -846,9 +846,25 @@ VPValue *VPSCEVExpander::tryToExpand(const SCEV *S) {
return Builder.createNaryOp(VPInstruction::VScale, {}, S->getType());
case scAddExpr:
case scMulExpr: {
- if (S->getType()->isPointerTy())
- return nullptr;
auto *NAry = cast<SCEVNAryExpr>(S);
+ VPIRFlags::WrapFlagsTy WrapFlags(NAry->hasNoUnsignedWrap(),
+ NAry->hasNoSignedWrap());
+
+ // Expanded poiner SCEVAddExpr as a ptradd of the pointer base and the
+ // integer offset, matching SCEVExpander.
+ if (S->getType()->isPointerTy()) {
+ VPValue *Base = tryToExpand(SE.getPointerBase(S));
+ if (!Base)
+ return nullptr;
+ VPValue *Offset = tryToExpand(SE.removePointerBase(S));
+ if (!Offset)
+ return nullptr;
+ GEPNoWrapFlags GEPFlags = WrapFlags.HasNUW
+ ? GEPNoWrapFlags::noUnsignedWrap()
+ : GEPNoWrapFlags::none();
----------------
artagnon wrote:
What about the nusw case? Also, why are we dropping self-wrap: does it not translate?
https://github.com/llvm/llvm-project/pull/206366
More information about the llvm-commits
mailing list