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

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 09:28:35 PDT 2020


dmgreen added reviewers: RKSimon, craig.topper, efriedma.
dmgreen 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) {
----------------
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.


================
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>
----------------
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.


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