[PATCH] D76434: [SCEV] Query expanded immediate cost at minsize
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 14 07:17:46 PDT 2020
lebedev.ri added a comment.
All this is (becoming?) so incredibly fragile...
Have you checked what happens if you simply make `isHighCostExpansionHelper()` always return `true` for `-Oz`? :)
This really needs refactoring/generalization.
================
Comment at: llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp:2364
+ if (CostKind == TTI::TCK_CodeSize)
+ costNAryImmOperands(NAry);
+ else
----------------
samparker wrote:
> Now I notice that I wouldn't have been handling AddRec expressions... So should these operands be added to the worklist for both Add and Mul or would just Add be okay?
Given `A + B*x`, you'd want to model `A` as being at index 1,
and `B` as being part of multipler (again, at index 1.
And for higher orders `A + B*x + C*x^2`, again, `B` and `C` are part of multiply,
and it should be modelled as `(B*x + C*x^2) + A`.
So i think the generalization is that all nary operands except the first one are at index 1 of `mul`,
and the first nary operand is at index 1 of `add`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76434/new/
https://reviews.llvm.org/D76434
More information about the llvm-commits
mailing list