[PATCH] D79096: [SelectionDAG] Unify scalarizeVectorLoad and VectorLegalizer::ExpandLoad

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 11:47:18 PDT 2020


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:6620
+      SDValue Elt =
+          DAG.getNode(ISD::AND, SL, LoadVT, ShiftedElt, SrcEltBitMask);
+      SDValue Scalar = DAG.getNode(ISD::TRUNCATE, SL, SrcEltVT, Elt);
----------------
LemonBoy wrote:
> craig.topper wrote:
> > Why do we need to AND before the TRUNCATE? Isn't the AND masking to the same number of bits as the truncate?
> I found that sometimes the generated pattern would be something like `(anyext DstEltVT (truncate SrcEltVT (load LoadVT))` so when the optimizer kicks in and folds the `truncate` and `anyext` only the load remains.
Why is that bad?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79096





More information about the llvm-commits mailing list