[PATCH] D123700: [VPlan] Turn external defs in Value -> VPValue mapping.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 13:54:19 PDT 2022


Ayal accepted this revision.
Ayal added a comment.
This revision is now accepted and ready to land.

Ship it!
minor nits.



================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:2468
 
   /// Holds all the external definitions created for this VPlan.
+  DenseMap<Value *, VPValue *> VPExternalDefs;
----------------
Can keep the explanation that external defs are immutable wrappers of underlying values.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:2566
 
   /// Add \p VPVal to the pool of external definitions if it's not already
   /// in the pool.
----------------
Comment deserves updating.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:2568
   /// in the pool.
-  void addExternalDef(VPValue *VPVal) { VPExternalDefs.insert(VPVal); }
+  VPValue *getOrAddExternalDef(Value *V) { auto I = VPExternalDefs.insert({V, nullptr});
+    if (I.second)
----------------
nit: clearer to start code block on next line.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123700



More information about the llvm-commits mailing list