[PATCH] D22652: GVH-hoist: only clone GEPs (PR28606)

Sebastian Pop via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 15:04:24 PDT 2016


sebpop added inline comments.

================
Comment at: llvm/lib/Transforms/Scalar/GVNHoist.cpp:586
@@ -585,3 +585,3 @@
       Gep = dyn_cast<GetElementPtrInst>(St->getPointerOperand());
       Val = dyn_cast<Instruction>(St->getValueOperand());
     }
----------------
majnemer wrote:
> We could put the check here:
>   ...
>   GetElementPtrInst *Val = nullptr;
>   if (auto *St = dyn_cast<StoreInst>(Repl)) {
>     Gep = ...
>     Val = dyn_cast<GetElementPtrInst>(St->getValueOperand());
I think this is not possible: we need to check whether the stored value is available at HoistPt.
If we dyn_cast Val to GEP this early we would only hoist GEP stores. 


https://reviews.llvm.org/D22652





More information about the llvm-commits mailing list