[PATCH] D76434: [SCEV] Query expanded immediate cost at minsize

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 02:04:20 PDT 2020


samparker added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp:2214-2217
+    case scAddExpr:
+      BudgetRemaining -=
+        TTI.getIntImmCostInst(Instruction::Add, Idx, Imm, Ty, CostKind);
+      break;
----------------
lebedev.ri wrote:
> I'm not convinced this modelling is correct.
> (which is why i didn't respond, but apparently i forgot to actually post that)
> 
> If we have SCEV `x + y + 42`, `42` will be modelled as-if it's at index `2`,
> but we should model this as `(x + y) + 42`, because there's usually some
> form of an `add` that takes an immediate as second param.
Ah! Right, I'll try to fix that.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76434/new/

https://reviews.llvm.org/D76434



More information about the llvm-commits mailing list