[PATCH] D122703: [AArch64][InstCombine] Fold MLOAD and zero extensions into MLOAD

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 04:54:29 PDT 2022


paulwalker-arm added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:6056
 
     // fold (and (masked_load) (build_vec (x, ...))) to zext_masked_load
+    // fold (and (masked_load) (splat_vec (x, ...))) to zext_masked_load
----------------
If you follow the advice below I'd also remove the `build_vec` comment as the `splat_vec` one is meaning full enough in itself.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:6058
     auto *MLoad = dyn_cast<MaskedLoadSDNode>(N0);
-    auto *BVec = dyn_cast<BuildVectorSDNode>(N1);
-    if (MLoad && BVec && MLoad->getExtensionType() == ISD::EXTLOAD &&
----------------
You could simplify the code by extract the splat here, i.e.
```
ConstantSDNode *Splat = isConstOrConstSplat(N1, true, true)
```
That would remove the separate buildvector and splatvector checks and also remove a level of indentation in the `TLI.isLoadExtLegal` block.


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

https://reviews.llvm.org/D122703



More information about the llvm-commits mailing list