[PATCH] D106667: SROA: Enhance speculateSelectInstLoads

Christudasan Devadasan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 5 10:14:19 PDT 2021


cdevadas added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SROA.cpp:1342-1346
+    BitCastInst *BC = dyn_cast<BitCastInst>(U);
+    if (BC && BC->hasOneUse())
+      LI = dyn_cast<LoadInst>(*BC->user_begin());
+    else
+      LI = dyn_cast<LoadInst>(U);
----------------
arsenm wrote:
> I think other places that handle this use a user worklist and don't have the one use restriction for the bitcast (e.g.  PointerReplacer::collectUsers)
For the transformation to happen, If there are multiple users of Bitcast, they should all be load instructions. That will make the IR non-canonical.   The one-use restriction makes sense I guess.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106667



More information about the llvm-commits mailing list