[all-commits] [llvm/llvm-project] 53b4c8: [X86] Attempt to fold extract_vector_elt(logicop(x...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Wed Apr 29 01:48:09 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 53b4c845adce97f2d012a826f8d276c145a5d97e
      https://github.com/llvm/llvm-project/commit/53b4c845adce97f2d012a826f8d276c145a5d97e
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2026-04-29 (Wed, 29 Apr 2026)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/known-never-zero.ll
    M llvm/test/CodeGen/X86/masked_store.ll
    M llvm/test/CodeGen/X86/pr173924.ll
    M llvm/test/CodeGen/X86/pr193700.ll
    M llvm/test/CodeGen/X86/pr45563-2.ll
    M llvm/test/CodeGen/X86/pr45833.ll
    M llvm/test/CodeGen/X86/ucmp.ll

  Log Message:
  -----------
  [X86] Attempt to fold extract_vector_elt(logicop(x,y),i) -> extract_vector_elt(x,i) (#194581)

When extracting from logicops, we often don't need to extract the result
if one of the element sources is identity (and(x,-1) -> x, or/xor(x,0)
-> x etc.), so this patch uses SimplifyMultipleUseDemandedVectorElts to
peek through to an underlying build_vector.

I had hoped to make this generic, but there's still a lot of yak shaving
to deal with first, as usual - I've included the minimal x86-specific
fixes:
 * missing constant folding of (vXi1 logicop(bitcast(c1),bitcast(c2)))
 * fold kshiftr(concat_vectors(x,y,z,w),c) -> concat_vectors(z,w,0,0)

Fixes #193700



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list