[PATCH] D144850: [AArch64] Don't remove free sext_inreg(vector_extract(x)) if it leads to multiple extracts

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 00:52:16 PST 2023


dmgreen created this revision.
dmgreen added reviewers: SjoerdMeijer, samtebbs, bipmis, david-arm, t.p.northover, RKSimon.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
dmgreen requested review of this revision.
Herald added a project: LLVM.

If we have `sext_inreg(vector_extract(x))` but the top bits are not used, DAG will try to remove the sext_inreg, using `vector_extract(x)` directly. This can lead to multiple uses of both `sext_inreg(vector_extract(x))` and `vector_extract(x)`, leading to the generation of both umov and smov extracts. This adds a target hook to prevent that under AArch64 where the `sext_inreg` can be considered free if there are multiple uses of the `sext` and no uses of the `vector_extract`. This helps fix a small regression from D144550 <https://reviews.llvm.org/D144550>.


https://reviews.llvm.org/D144850

Files:
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.h
  llvm/test/CodeGen/AArch64/extract-sext-zext.ll
  llvm/test/CodeGen/AArch64/srem-vector-lkk.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144850.500685.patch
Type: text/x-patch
Size: 9681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230227/0953158d/attachment.bin>


More information about the llvm-commits mailing list