[PATCH] D99412: [AArch64][SVEIntrinsicOpts] Optimize tbl+dup into dup+extractelement

JunMa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 28 19:12:38 PDT 2021


junparser added inline comments.


================
Comment at: llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp:466-467
+  auto *Extract = Builder.CreateExtractElement(OpVal, SplatValue);
+  auto *NewDupX =
+      Builder.CreateIntrinsic(Intrinsic::aarch64_sve_dup_x, {VTy}, {Extract});
+
----------------
paulwalker-arm wrote:
> Can you use `Builder.CreateVectorSplat` here?
done


================
Comment at: llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp:469-470
+
+  I->replaceAllUsesWith(NewDupX);
+  I->eraseFromParent();
+  return true;
----------------
paulwalker-arm wrote:
> I'm never really sure what to do in these instances but do we need to worry about the original DupXIntrI?  Given we know its operand is constant it's easily removed if this was the only use.
replaceAllUsesWith and eraseFromParent usually appear together. we can ignore the Dup intrinsic here. However, we should remove it since it has no side effect, no use. Remove it can be safe.


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

https://reviews.llvm.org/D99412



More information about the llvm-commits mailing list