[PATCH] D150900: [InstCombine] Insert a bitcast to enable merging similar store insts

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 22 01:51:55 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:1655-1659
       if ((OtherStore = dyn_cast<StoreInst>(BBI))) {
-        if (OtherStore->getOperand(1) != SI.getOperand(1) ||
-            !SI.isSameOperationAs(OtherStore))
+        if (!OtherStoreIsMergeable(OtherStore))
           return false;
         break;
       }
----------------
foad wrote:
> This can be simplified as suggested, since if we find a non-mergable store, the `mayWriteToMemory` test just below will do the `return false`.
> 
> Also I think moving the cast-to-StoreInst inside the helper function would make the patch simpler overall, i.e. something like:
> ```
> auto IsMergeableStore = [&](Instruction *OtherStore) -> bool ...
> ```
We still need the StoreInst to assign to OtherStore, so I don't think moving the cast into the helper would work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150900



More information about the llvm-commits mailing list