[all-commits] [llvm/llvm-project] a5ce2d: [NFC]Pre-commit test case

Mingming Liu via All-commits all-commits at lists.llvm.org
Mon Mar 27 10:56:08 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a5ce2da0545bd19d158e1c7e80474d9ddaf5df66
      https://github.com/llvm/llvm-project/commit/a5ce2da0545bd19d158e1c7e80474d9ddaf5df66
  Author: Mingming Liu <mingmingl at google.com>
  Date:   2023-03-27 (Mon, 27 Mar 2023)

  Changed paths:
    A llvm/test/CodeGen/AArch64/aarch64-icmp-opt.ll
    M llvm/test/CodeGen/AArch64/arm64-csel.ll

  Log Message:
  -----------
  [NFC]Pre-commit test case

Pre-commit test cases to show missed icmp-opt with flag-setting ALUs

Reviewed By: dmgreen

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


  Commit: ec864a537160288a9cf7aea965cf33b0851d6d55
      https://github.com/llvm/llvm-project/commit/ec864a537160288a9cf7aea965cf33b0851d6d55
  Author: Mingming Liu <mingmingl at google.com>
  Date:   2023-03-27 (Mon, 27 Mar 2023)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
    M llvm/test/CodeGen/AArch64/aarch64-icmp-opt.ll
    M llvm/test/CodeGen/AArch64/arm64-csel.ll

  Log Message:
  -----------
  [AArch64][PeepholeOpt]Optimize ALU + compare to flag-setting ALU

The motivating example is in https://godbolt.org/z/45nbdYMK9
- For this example, `subs` is generated for the good case; `sub` followed by `cmp` is generated for the bad case. Since signed overflow is undefined behavior in C/C++ (indicated as `nsw` flag in LLVM IR), `subs` should be generated for the good case as well.

This patch relaxes one restriction from "quit optimization when V is used" to "continue if MI produces poison value when signed overflow occurs". This is not meant to be C/C++ specific since it looks at 'NoSWrap' since it looks at MachineInstr flags.

Reviewed By: dmgreen

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


Compare: https://github.com/llvm/llvm-project/compare/43290c95631a...ec864a537160


More information about the All-commits mailing list