[all-commits] [llvm/llvm-project] 005173: [X86] `X86TargetLowering`: override `allowsMemoryA...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Sat Jan 21 13:18:33 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 005173cbb609f79adc2018e378bc6897cf84b06d
      https://github.com/llvm/llvm-project/commit/005173cbb609f79adc2018e378bc6897cf84b06d
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2023-01-22 (Sun, 22 Jan 2023)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.h
    M llvm/test/CodeGen/X86/add-sub-bool.ll
    M llvm/test/CodeGen/X86/bswap-wide-int.ll
    M llvm/test/CodeGen/X86/fshl.ll
    M llvm/test/CodeGen/X86/fshr.ll
    M llvm/test/CodeGen/X86/i128-add.ll
    M llvm/test/CodeGen/X86/icmp-shift-opt.ll
    M llvm/test/CodeGen/X86/legalize-shl-vec.ll
    M llvm/test/CodeGen/X86/merge-consecutive-stores-nt.ll
    M llvm/test/CodeGen/X86/setcc-wide-types.ll
    M llvm/test/CodeGen/X86/smin.ll
    M llvm/test/CodeGen/X86/smul-with-overflow.ll
    M llvm/test/CodeGen/X86/smulo-128-legalisation-lowering.ll
    M llvm/test/CodeGen/X86/umin.ll
    M llvm/test/CodeGen/X86/umul-with-overflow.ll
    M llvm/test/CodeGen/X86/wide-integer-cmp.ll
    M llvm/test/CodeGen/X86/xaluo128.ll

  Log Message:
  -----------
  [X86] `X86TargetLowering`: override `allowsMemoryAccess()`

The baseline `allowsMemoryAccess()` is wrong for X86.
It assumes that aligned memory operations are always allowed,
but that is not true.

For example, We can not perform a 32-byte aligned non-temporal load
of a 32-byte vector, without AVX2 that is, yet `allowsMemoryAccess()`
will say it is allowed, so we may end up merging non-temporal loads,
only to split them up to legalize them, and here we go again.

NOTE: the test changes here are superfluous. The main effect is that without this change,
in D141777, we'd get stuck endlessly merging and splitting non-temporal stores.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D141776




More information about the All-commits mailing list