[PATCH] D75634: [ConstantFolding] Accept FoldedOps cache as parameter

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 16:20:20 PST 2020


efriedma added inline comments.


================
Comment at: lib/Analysis/ConstantFolding.cpp:1192
+                           SmallDenseMap<Constant *, Constant *> &FoldedOps) {
+  if (!isa<ConstantVector>(C) && !isa<ConstantExpr>(C))
+    return const_cast<Constant *>(C);
----------------
nikic wrote:
> efriedma wrote:
> > Do you have any idea why we're checking for ConstantVector specifically, instead of ConstantAggregate?
> The ConstantVector handling was added lateron in https://github.com/llvm/llvm-project/commit/d536f2328ededb3aae6563c721c6134c735f1918, so the reason might be just "it hasn't been implemented".
> 
> Maybe there is also a compile-time concern here? A ConstantVector will usually have relatively few operands, while a ConstantArray might have thousands.
"it hasn't been implemented" makes sense, I guess.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75634





More information about the llvm-commits mailing list