[all-commits] [llvm/llvm-project] e9b26b: [RISCV] Add test case for miscompile caused by tre...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Apr 5 22:24:14 PDT 2022


  Branch: refs/heads/release/14.x
  Home:   https://github.com/llvm/llvm-project
  Commit: e9b26b5b2a709156f6d68927fa01c0a0540ea625
      https://github.com/llvm/llvm-project/commit/e9b26b5b2a709156f6d68927fa01c0a0540ea625
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-04-05 (Tue, 05 Apr 2022)

  Changed paths:
    M llvm/test/CodeGen/RISCV/aext-to-sext.ll

  Log Message:
  -----------
  [RISCV] Add test case for miscompile caused by treating ANY_EXTEND of constants as SIGN_EXTEND.

The code that inserts AssertZExt based on predecessor information assumes
constants are zero extended for phi incoming values this allows
AssertZExt to be created in blocks consuming a Phi.
SelectionDAG::getNode treats any_extend of i32 constants as sext for RISCV.
The code that creates phi incoming values in the predecessors creates an
any_extend for the constants which then gets treated as a sext by getNode.
This makes the AssertZExt incorrect and can cause zexts to be
incorrectly removed.

This bug was introduced by D105918

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

(cherry picked from commit 268371cf7b9f6fd3b9320564f1abd3615eecd2e8)


  Commit: 5b9dd016bec7652c311266055e5f89342cb90e60
      https://github.com/llvm/llvm-project/commit/5b9dd016bec7652c311266055e5f89342cb90e60
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-04-05 (Tue, 05 Apr 2022)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    M llvm/test/CodeGen/RISCV/aext-to-sext.ll

  Log Message:
  -----------
  [SelectionDAG][RISCV] Make RegsForValue::getCopyToRegs explicitly zero_extend constants.

ComputePHILiveOutRegInfo assumes that constant incoming values to
Phis will be zero extended if they aren't a legal type. To guarantee
that we should zero_extend rather than any_extend constants.

This fixes a bug for RISCV where any_extend of constants can be
treated as a sign_extend.

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

(cherry picked from commit 4eb59f017903c8b70b5c5aad892bdc73516a6766)


  Commit: c9ec4902c3e32ce329db26e3f42c5e93c3135e57
      https://github.com/llvm/llvm-project/commit/c9ec4902c3e32ce329db26e3f42c5e93c3135e57
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-04-05 (Tue, 05 Apr 2022)

  Changed paths:
    M llvm/test/tools/llvm-objdump/ELF/private-headers.test
    M llvm/test/tools/llvm-objdump/ELF/program-headers.test

  Log Message:
  -----------
  [llvm-objdump][test] dos2unix some files

(cherry picked from commit 423af54cbef7b90199e01162dcea6d3e62539e8c)


  Commit: 1007cb795a3c82eab231b58569ea06a2b613636a
      https://github.com/llvm/llvm-project/commit/1007cb795a3c82eab231b58569ea06a2b613636a
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-04-05 (Tue, 05 Apr 2022)

  Changed paths:
    M llvm/lib/Object/ELF.cpp
    A llvm/test/tools/llvm-objdump/ELF/dynamic-malformed.test
    M llvm/test/tools/llvm-objdump/ELF/invalid-phdr.test
    M llvm/test/tools/llvm-objdump/ELF/program-headers.test
    M llvm/tools/llvm-objdump/ELFDump.cpp

  Log Message:
  -----------
  [llvm-objdump] --private-headers: change errors to warnings for dynamic section dumping

Fix #54456: `objcopy --only-keep-debug` produces a linked image with invalid
empty dynamic section. llvm-objdump -p currently reports an error which seems
excessive.

```
% llvm-readelf -l a.out
llvm-readelf: warning: 'a.out': no valid dynamic table was found
...
```

Follow the spirit of llvm-readelf -l (D64472) and report a warning instead.
This allows later files to be dumped despite warnings for an input file, and
improves objdump compatibility in that the exit code is now 0 instead of 1.

```
% llvm-objdump -p a.out  # new behavior
...
Program Header:
llvm-objdump: warning: 'a.out': invalid empty dynamic section
% objdump -p a.out
...
Dynamic Section:

```

Reviewed By: jhenderson, raj.khem

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

(cherry picked from commit 11a8fc685692f56b011f851d974f0cac534f2cb8)


  Commit: 311a622edd31422c0969913285e54d4778477a12
      https://github.com/llvm/llvm-project/commit/311a622edd31422c0969913285e54d4778477a12
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-04-05 (Tue, 05 Apr 2022)

  Changed paths:
    M llvm/test/Object/invalid.test

  Log Message:
  -----------
  [Object][test] Fix invalid.test

(cherry picked from commit f7086401b7c03179b755768845956bc8e84ab266)


Compare: https://github.com/llvm/llvm-project/compare/a4681df0202c...311a622edd31


More information about the All-commits mailing list