[all-commits] [llvm/llvm-project] e665e7: [SelectionDAG] Use the nuw flag when expanding loa...

Dan Gohman via All-commits all-commits at lists.llvm.org
Tue Dec 10 06:28:30 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e665e781dc3f8fac0400f6ac8e168805b0cdf74a
      https://github.com/llvm/llvm-project/commit/e665e781dc3f8fac0400f6ac8e168805b0cdf74a
  Author: Dan Gohman <dev at sunfishcode.online>
  Date:   2024-12-10 (Tue, 10 Dec 2024)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
    M llvm/test/CodeGen/AMDGPU/buffer-intrinsics-mmo-offsets.ll
    M llvm/test/CodeGen/WebAssembly/fpclamptosat.ll
    M llvm/test/CodeGen/WebAssembly/fpclamptosat_vec.ll
    M llvm/test/CodeGen/WebAssembly/i128.ll
    M llvm/test/CodeGen/WebAssembly/libcalls-trig.ll
    M llvm/test/CodeGen/WebAssembly/libcalls.ll
    M llvm/test/CodeGen/WebAssembly/multi-return.ll
    M llvm/test/CodeGen/WebAssembly/multivalue_libcall.ll
    M llvm/test/CodeGen/WebAssembly/umulo-128-legalisation-lowering.ll

  Log Message:
  -----------
  [SelectionDAG] Use the nuw flag when expanding loads. (#119288)

When expanding a load into two loads, use nuw for the add that computes
the offset from the base of the second load, because the original load
doesn't straddle the address space.

It turns out there's already a dedicated helper function for doing this,
`getObjectPtrOffset`.

This is in target-independent code, however in practice it only seems to
affact WebAssembly code, because WebAssembly load and store
instructions' constant offsets don't perform wrapping, so constant
folding often depends on the nuw flag being present.

This was noticed in the development of #119204.



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