[PATCH] D152082: [ValueTracking] getUnderlyingObject() look through phi.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 4 03:31:00 PDT 2023


nikic added a comment.

Results: https://llvm-compile-time-tracker.com/?config=NewPM-O3&stat=instructions%3Au&branch=nikic/perf/underlyingphi

As expected, a major regression. I've left some suggestions for possible improvements.



================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:5648
+  unsigned Count = 0;
+  DenseMap<const Value *, const Value *> Visited;
+
----------------
SmallDenseMap


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:5650
+
+  std::function<const Value *(const Value *)> Visit = [&](const Value *Root) {
+    const Value *V = Root;
----------------
Don't use std::function


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:5653
+    if (Visited.contains(V))
+      return Visited.at(V);
+    if (!V->getType()->isPointerTy() || (MaxLookup != 0 && Count == MaxLookup))
----------------
Only use `Visited` on the phi path.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152082



More information about the llvm-commits mailing list