[llvm] [VPlan] Explicitly handle scalar pointer inductions. (PR #83068)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 26 07:53:44 PDT 2024
================
@@ -270,10 +271,38 @@ VPInstruction::VPInstruction(unsigned Opcode,
assert(isFPMathOp() && "this op can't take fast-math flags");
}
-Value *VPInstruction::generateInstruction(VPTransformState &State,
- unsigned Part) {
+bool VPInstruction::doesGeneratePerAllLanes() const {
+ return Opcode == VPInstruction::PtrAdd && !vputils::onlyFirstLaneUsed(this);
+}
+
+bool VPInstruction::canGenerateScalarForFirstLane() const {
+ if (Instruction::isBinaryOp(getOpcode()))
+ return true;
+
+ switch (Opcode) {
+ case VPInstruction::BranchOnCond:
+ case VPInstruction::BranchOnCount:
+ case VPInstruction::CalculateTripCountMinusVF:
+ case VPInstruction::CanonicalIVIncrementForPart:
+ case VPInstruction::ComputeReductionResult:
+ case VPInstruction::PtrAdd:
+ return true;
+ default:
+ return false;
+ }
+}
+
+Value *VPInstruction::generatePerLane(VPTransformState &State,
+ const VPIteration &Lane) {
+ IRBuilderBase &Builder = State.Builder;
+
+ assert(getOpcode() == VPInstruction::PtrAdd);
----------------
fhahn wrote:
added, thanks!
https://github.com/llvm/llvm-project/pull/83068
More information about the llvm-commits
mailing list