[all-commits] [llvm/llvm-project] 5eb24f: [SelectionDAG][RISCV] Preserve nneg flag when fold...

Craig Topper via All-commits all-commits at lists.llvm.org
Thu Jun 19 08:06:28 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5eb24fde11cd82a08f208509f80f428da90c89c9
      https://github.com/llvm/llvm-project/commit/5eb24fde11cd82a08f208509f80f428da90c89c9
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2025-06-19 (Thu, 19 Jun 2025)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/RISCV/shifts.ll

  Log Message:
  -----------
  [SelectionDAG][RISCV] Preserve nneg flag when folding (trunc (zext X))->(zext X). (#144807)

If X is known non-negative, that's still true if we fold the truncate
to create a smaller zext.
    
In the i128 tests, SelectionDAGBuilder aggressively truncates the
`zext nneg` to i64 to match `getShiftAmountTy`. If we don't preserve
the `nneg` we can't see that the shift amount argument being `signext`
means we don't need to do any extension



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list