[all-commits] [llvm/llvm-project] 9deee6: [SDAG] Don't transfer !range metadata without !nou...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Aug 14 00:04:45 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9deee6bffa9c331f46c68e5dd4cb4abf93dc0716
      https://github.com/llvm/llvm-project/commit/9deee6bffa9c331f46c68e5dd4cb4abf93dc0716
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-08-14 (Mon, 14 Aug 2023)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    M llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
    M llvm/test/CodeGen/AArch64/lower-range-metadata-func-call.ll
    M llvm/test/CodeGen/AMDGPU/array-ptr-calc-i32.ll
    M llvm/test/CodeGen/AMDGPU/global-saddr-load.ll
    M llvm/test/CodeGen/AMDGPU/load-range-metadata-assert.ll
    M llvm/test/CodeGen/AMDGPU/load-range-metadata-sign-bits.ll
    M llvm/test/CodeGen/PowerPC/BreakableToken-reduced.ll
    M llvm/test/CodeGen/PowerPC/global-address-non-got-indirect-access.ll
    M llvm/test/CodeGen/X86/legalize-vec-assertzext.ll
    M llvm/test/CodeGen/X86/pr12360.ll
    M llvm/test/CodeGen/X86/pr48458.ll
    M llvm/test/CodeGen/X86/pr48888.ll
    M llvm/test/CodeGen/X86/pr64589.ll

  Log Message:
  -----------
  [SDAG] Don't transfer !range metadata without !noundef to SDAG (PR64589)

D141386 changed the semantics of !range metadata to return poison
on violation. If !range is combined with !noundef, violation is
immediate UB instead, matching the old semantics.

In theory, these IR semantics should also carry over into SDAG.
In practice, DAGCombine has at least one key transform that is
invalid in the presence of poison, namely the conversion of logical
and/or to bitwise and/or (https://github.com/llvm/llvm-project/blob/c7b537bf0923df05254f9fa4722b298eb8f4790d/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp#L11252).
Ideally, we would fix this transform, but this will require
substantial work to avoid codegen regressions.

In the meantime, avoid transferring !range metadata without
!noundef, effectively restoring the old !range metadata semantics
on the SDAG layer.

Fixes https://github.com/llvm/llvm-project/issues/64589.

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




More information about the All-commits mailing list