[all-commits] [llvm/llvm-project] 1fb87a: [RISCV] Optimize x > 1 ? x : 1 -> x > 0 ? x : 1

ChunyuLiao via All-commits all-commits at lists.llvm.org
Sun Aug 21 05:26:55 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1fb87ace4d097138de0027e633d9d6d83246093b
      https://github.com/llvm/llvm-project/commit/1fb87ace4d097138de0027e633d9d6d83246093b
  Author: LiaoChunyu <chunyu at iscas.ac.cn>
  Date:   2022-08-21 (Sun, 21 Aug 2022)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/forced-atomics.ll

  Log Message:
  -----------
  [RISCV] Optimize x > 1 ? x : 1 -> x > 0 ? x : 1

if x == 1,
  x > 1 ? x : 1  return x, which is also 1.
  x > 0 ? x : 1  return 1.

Reduce the number of load 1 instructions.

Reviewed By: craig.topper

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




More information about the All-commits mailing list