[llvm] [VPlan] Model first memory runtime checks as VPlan recipes. (PR #221483)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 23 06:50:28 PDT 2026
================
@@ -1077,9 +1078,31 @@ VPValue *VPSCEVExpander::expand(const SCEV *S) {
Ops.push_back(OpV);
}
VPValue *Result = Ops.front();
- for (VPValue *Op : drop_begin(Ops))
- Result = Builder.createScalarIntrinsic(IntrinsicID, {Result, Op},
- ResultTy, DL);
+ for (VPValue *Op : drop_begin(Ops)) {
+ if (ResultTy->isPointerTy()) {
+ // The min/max intrinsics don't support pointer operands, so expand
+ // pointer-typed min/max as cmp + select, matching SCEVExpander.
+ VPValue *Cmp = Builder.createICmp(
+ MinMaxIntrinsic::getPredicate(IntrinsicID), Result, Op, DL);
+ VPInstruction *Sel = Builder.createSelect(Cmp, Result, Op, DL);
+ Function *F =
+ Builder.getPlan().getScalarHeader()->getIRBasicBlock()->getParent();
+ std::optional<uint64_t> EC = F->getEntryCount();
+ if (EC && *EC > 0) {
----------------
fhahn wrote:
removed from the diff for now
https://github.com/llvm/llvm-project/pull/221483
More information about the llvm-commits
mailing list