[llvm] [VPlan] Introduce VPlanConstantFolder (PR #125365)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 22 14:07:29 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) {
+ VPlan *Plan = R.getParent()->getPlan();
+ ArrayRef<VPValue *> Ops{I->op_begin(), I->op_end()};
----------------
fhahn wrote:
```suggestion
ArrayRef<VPValue *> Ops(I->op_begin(), I->op_end());
```
`()` for constructors is much more common in the LVLM code base AFAICT
https://github.com/llvm/llvm-project/pull/125365
More information about the llvm-commits
mailing list