[PATCH] D145866: [DAG] visitAND - fold (and (any_ext V), c) -> (zero_ext (and (trunc V), c)) if profitable.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 12 04:28:40 PDT 2023


RKSimon created this revision.
RKSimon added reviewers: arsenm, foad, pengfei, kazu, goldstein.w.n.
Herald added subscribers: kosarev, StephenFan, ecnelises, kerbowa, hiraditya, jvesely.
Herald added a project: All.
RKSimon requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

Try to more aggressively narrow masks of extended values.

This is mainly for cases where the mask is trying to zero out any_extended upper bits, assuming we can zext/trunc the values for free.

This catches a few actual missed folds, as well as helps canonicalize a number of other cases which were being caught in isel etc.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145866

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-idiv.ll
  llvm/test/CodeGen/AMDGPU/load-constant-i16.ll
  llvm/test/CodeGen/AMDGPU/load-global-i16.ll
  llvm/test/CodeGen/AMDGPU/promote-constOffset-to-imm.ll
  llvm/test/CodeGen/X86/3addr-or.ll
  llvm/test/CodeGen/X86/abdu.ll
  llvm/test/CodeGen/X86/addcarry.ll
  llvm/test/CodeGen/X86/avx512cd-intrinsics-upgrade.ll
  llvm/test/CodeGen/X86/avx512cdvl-intrinsics-upgrade.ll
  llvm/test/CodeGen/X86/avx512fp16-mov.ll
  llvm/test/CodeGen/X86/cmp-concat.ll
  llvm/test/CodeGen/X86/dag-update-nodetomatch.ll
  llvm/test/CodeGen/X86/is_fpclass-fp80.ll
  llvm/test/CodeGen/X86/memset-inline.ll
  llvm/test/CodeGen/X86/memset-nonzero.ll
  llvm/test/CodeGen/X86/memset-vs-memset-inline.ll
  llvm/test/CodeGen/X86/narrow-shl-cst.ll
  llvm/test/CodeGen/X86/pr30562.ll
  llvm/test/CodeGen/X86/pr35763.ll
  llvm/test/CodeGen/X86/subcarry.ll
  llvm/test/CodeGen/X86/switch-phi-const.ll
  llvm/test/CodeGen/X86/switch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145866.504419.patch
Type: text/x-patch
Size: 126837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230312/82b43480/attachment-0001.bin>


More information about the llvm-commits mailing list