[PATCH] D130233: [LoopLoadElim] Add stores with matching sizes as load-store candidates

Jolanta Jensen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 07:22:30 PDT 2022


jolanta.jensen marked 4 inline comments as done.
jolanta.jensen added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp:448
+    Type *LoadType = Initial->getType();
+    Type *StoreType = Cand.Store->getOperand(0)->getType();
+    auto &DL = Cand.Load->getParent()->getModule()->getDataLayout();
----------------
fhahn wrote:
> nit: `getStoredValue()` would be more explicit than `getOperand(0)`.
I did not find getStoredValue() in StoreInst class. I changed to getValueOperand() instead.


================
Comment at: llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp:461
+    else
+      StoreValue = Cand.Store->getOperand(0);
+
----------------
fhahn wrote:
> Nit: could change to 
> 
> ```
>     Value *StoreValue = Cand.Store->getOperand(0);` 
>     if (...)
>        StoreValue = CastInst::CreateBitOrPointerCast(StoreValue, LoadType,
>                                            "store_forward_cast", Cand.Store);
> ```
Also replaced getOperand(0) with getValueOperand().


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130233



More information about the llvm-commits mailing list