[llvm] [GVN] Look through select/phi when determining underlying object (PR #99509)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 06:52:19 PDT 2024


================
@@ -6609,6 +6609,46 @@ void llvm::getUnderlyingObjects(const Value *V,
   } while (!Worklist.empty());
 }
 
+const Value *llvm::getUnderlyingObjectAggressive(const Value *V) {
+  const unsigned MaxVisited = 8;
+
+  SmallPtrSet<const Value *, 8> Visited;
+  SmallVector<const Value *, 8> Worklist;
+  Worklist.push_back(V);
+  const Value *Object = nullptr, *FirstObject = nullptr;
+  do {
+    const Value *P = Worklist.pop_back_val();
+    P = getUnderlyingObject(P);
+
+    if (!FirstObject)
+      FirstObject = P;
----------------
nikic wrote:

Oh yeah, that wasn't supposed to be there anymore... Dropped in https://github.com/llvm/llvm-project/pull/99509/commits/44714f08c499f310984ccfe16bb28d08a78ae279.

https://github.com/llvm/llvm-project/pull/99509


More information about the llvm-commits mailing list