[PATCH] D70752: LowerDbgDeclare: look through bitcasts.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 13:21:23 PST 2019


aprantl added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:1425
+    SmallVector<const Value *, 8> WorkList;
+    WorkList.push_back(AI);
+    while (!WorkList.empty()) {
----------------
aprantl wrote:
> vsk wrote:
> > aprantl wrote:
> > > I think the worklist is overkill here, since it will contain at most one element. How about turning the loop body into a helper function/lambda and calling it recursively?
> > I think the worklist would contain more than one element in this case:
> > ```
> > %a = alloca
> > %c1 = bitcast %a to ...
> > call void @use(%c1)
> > %c2 = bitcast %a to ...
> > call void @use(%c2)
> > ```
> > That is probably worth a test, though.
> But that would also work fine with the recursive implementation, right?
Unless we are expecting very deep recursion I would prefer the recursive solution over the worklist since it is much easier to understand.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70752





More information about the llvm-commits mailing list