[llvm] [VPlan] Introduce VPlanConstantFolder (PR #125365)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 22 14:05:18 PDT 2025
================
@@ -1047,15 +1049,27 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
R.setOperand(0, Y);
return;
}
+
+ // Constant folding.
+ VPConstantFolder Folder(DL, TypeInfo);
+ TypeSwitch<VPRecipeBase *, void>(&R)
+ .Case<VPInstruction, VPWidenRecipe, VPWidenCastRecipe, VPHistogramRecipe,
+ VPPartialReductionRecipe, VPReplicateRecipe>([&](auto *I) {
----------------
fhahn wrote:
Not sure if it makes sense to apply constant folding to VPHistogramRecipe/VPPartialReductionRecipe, those do more than applying the opcode to the operands.
https://github.com/llvm/llvm-project/pull/125365
More information about the llvm-commits
mailing list