[all-commits] [llvm/llvm-project] 2b20c3: [SelectionDAG] Fix problematic call to EVT::change...

Anmol P. Paralkar via All-commits all-commits at lists.llvm.org
Tue Aug 15 02:09:31 PDT 2023

  Branch: refs/heads/release/17.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 2b20c3fe19637e4ad842decce552d5ad95c199b7
  Author: Paul Walker <paul.walker at arm.com>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    M llvm/test/CodeGen/AArch64/active_lane_mask.ll

  Log Message:
  [SelectionDAG] Fix problematic call to EVT::changeVectorElementType().

The function changeVectorElementType assumes MVT input types will
result in MVT output types.  There's no gurantee this is possible
during early code generation and so this patch converts an instance
used during initial DAG construction to instead explicitly create a
new EVT.

NOTE: I could have added more MVTs, but that seemed unscalable as
you can either have MVTs with 100% element count coverage or 100%
bitwidth coverage, but not both.

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

(cherry picked from commit b7e6e568b4f28124060b868e433f36af18c510db)

  Commit: 9b202cad8905c54e5da394b4739a0df5bc7eb3ae
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    A llvm/test/CodeGen/X86/pr64589.ll

  Log Message:
  [X86] Add test for PR64589 (NFC)

(cherry picked from commit 59d558a37850611f9b63a5c1a8bfe87a9606c81e)

  Commit: f1249072f39e539386572ce46a76743c58b00608
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-08-15 (Tue, 15 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

(cherry picked from commit 9deee6bffa9c331f46c68e5dd4cb4abf93dc0716)

  Commit: 4985bd41bd7cbd0d1b34652d2ea9f33d75395cd9
  Author: Valentin Clement <clementval at gmail.com>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    M flang/lib/Optimizer/Transforms/CMakeLists.txt

  Log Message:
  [flang] Add missing dependency on tablegen files

This issue was raised on https://github.com/llvm/llvm-project/issues/64268.

`flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp` includes
`flang/Optimizer/HLFIR/HLFIRDialect.h` and might fails if the HLFIR related
tablegen files have not been generated.

Reviewed By: vzakhari

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

(cherry picked from commit 103907bc5fcf656b1551e191af8176cd7bfb91da)

  Commit: 38908de2fb35a51afc5a15eb58cf38df56bf667a
  Author: Kadir Cetinkaya <kadircet at google.com>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    M clang/lib/Sema/SemaLookup.cpp
    R clang/test/SemaCXX/using-hiding.cpp

  Log Message:
  Revert "[Sema] Fix handling of functions that hide classes"

This reverts commit d031ff38779bd688c514136dbdcce3169ee82b6e.
See https://reviews.llvm.org/D154503#4576393 for a reproducer and

(cherry picked from commit 7d259b36d2e8148d13087844e6494ad3a5c63edf)

  Commit: 53671fcffc9cb76e21b1396bd115f9a3e420eb47
  Author: Piotr Zegar <me at piotrzegar.pl>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    M clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
    M clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp

  Log Message:
  [clang-tidy] Fix crash when diagnostic is emit with invalid location

Fix crash when diagnostic is emit with invalid location,
but with attached valid ranges. Diagnostic can contain
invalid location, but SourceManager attached to it still
can be valid, use it in such case or fallback to known

Fixes: #64602

Reviewed By: aaron.ballman

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

(cherry picked from commit efd44f80a5a8194b9fe26ff3244ce702cd8dab73)

  Commit: 3c0e8be5ba492a8fb1d7aa9af7509c80d64865ec
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Driver/ToolChain.h
    M clang/lib/Driver/ToolChain.cpp
    M clang/test/Driver/clang-g-opts.c

  Log Message:
  [Driver] Default riscv*- triples to -fdebug-default-version=4

This adds a RISC-V special case to ToolChain::GetDefaultDwarfVersion,
affecting Linux/Haiku/RISCVToolChain.

DWARF v5 .debug_loclists/.debug_rnglists's
DW_LLE_offset_pair/DW_RLE_offset_pair entry kinds utilitize `.uleb128 A-B`
directives where A and B reference local labels in code sections.
When A and B are separated by a RISC-V linker-relaxable instruction,
A-B is incorrectly folded without a relocation, causing incorrect debug

void ext(void);
int foo(int x) {ext(); return 0;}
// DW_AT_location [DW_FORM_loclistx] of a DW_TAG_formal_parameter references a DW_LLE_offset_pair that can be incorrect after linker relaxation.

int ext(void);
void foo() { {
  int ret = ext();
  if (__builtin_expect(ret, 0))
} }
// DW_AT_ranges [DW_FORM_rnglistx] of a DW_TAG_lexical_block references a DW_RLE_offset_pair that can be incorrect after linker relaxation.

D157657 will implement R_RISCV_SET_ULEB128/R_RISCV_SUB_ULEB128
relocations, fixing the issue, but the relocation is only supported by
bleeding-edge binutils 2.41 and not by lld/ELF yet.

The goal is to make the emitted DWARF correct after linking.
Many users don't care about the default DWARF version, but a linker
error will be unacceptable. Let's just downgrade the default DWARF
version, before binutils>=2.41 is more widely available.

An alternative compatibility option is to add a toggle to DwarfDebug.cpp,
but that doesn't seem like a good idea.

Reviewed By: asb, kito-cheng

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

(cherry picked from commit bbc0f99f3bc96f1db16f649fc21dd18e5b0918f6)
(with a release note)

  Commit: 2f0fb9346d0b384155aff327e3f33d8968626835
  Author: Anmol P. Paralkar <anmol.paralkar at oss.nxp.com>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVPushPopOptimizer.cpp
    A llvm/test/CodeGen/RISCV/push-pop-opt-crash.ll

  Log Message:
  [RISCV] Add bounds check before use on returned iterator.

Check iterator validity before use; fixes a crash seen in the RISC-V
Zcmp Push/Pop optimization pass when compiling an internal benchmark.

Reviewed By: asb, wangpc

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

(cherry picked from commit 53e89f5e3f2cefa432f7262343654c2a582dcbe1)

Compare: https://github.com/llvm/llvm-project/compare/04b49144ace0...2f0fb9346d0b

More information about the All-commits mailing list