[PATCH] D84332: [DAGCombiner] Fold sext_inreg of a masked load into a signed extended masked load

Sam Tebbs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 07:56:08 PDT 2020


samtebbs marked 2 inline comments as done.
samtebbs added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:11131
+  if (MaskedLoadSDNode *Ld = dyn_cast<MaskedLoadSDNode>(N0)) {
+    if (ExtVT == Ld->getMemoryVT() && !LegalOperations &&
+        Ld->getExtensionType() != ISD::LoadExtType::SEXTLOAD) {
----------------
dmgreen wrote:
> I think you need to check for hasOneUse. And maybe with more of the checks from the above `fold (sext_inreg (zextload x))` case too, like checking types match and maybe for legal masked loads.
Thanks, I do need to add those. But for checking if masked loads are legal, is that necessary if there is already a masked load in the DAG?


================
Comment at: llvm/test/CodeGen/Thumb2/sext-masked-load.ll:22
+  %0 = bitcast i16* %next.gep to <4 x i16>*
+  %wide.masked.load = call <4 x i16> @llvm.masked.load.v4i16.p0v4i16(<4 x i16>* %0, i32 2, <4 x i1> %active.lane.mask, <4 x i16> undef)
+  %1 = sitofp <4 x i16> %wide.masked.load to <4 x float>
----------------
dmgreen wrote:
> Can you simplify this down to just a llvm.masked.load.v4i16.p0v4i16 and a sitofp ?
> Ideally they would look something like the tests in llvm/test/CodeGen/Thumb2/mve-masked-load.ll.
> 
> If so can you also add some other tests for different types and for uitofp.
Sure! I'll give that a shot.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84332





More information about the llvm-commits mailing list