[all-commits] [llvm/llvm-project] 562076: [CIR] Add Commutative/Idempotent traits to binary ops

Henrich Lauko via All-commits all-commits at lists.llvm.org
Sun Mar 8 06:02:36 PDT 2026


  Branch: refs/heads/users/xlauko/cir-min-max-ops
  Home:   https://github.com/llvm/llvm-project
  Commit: 56207698bc19ee1546a01e6f26505236da56302c
      https://github.com/llvm/llvm-project/commit/56207698bc19ee1546a01e6f26505236da56302c
  Author: xlauko <xlauko at mail.muni.cz>
  Date:   2026-03-08 (Sun, 08 Mar 2026)

  Changed paths:
    M clang/include/clang/CIR/Dialect/IR/CIROps.td
    M clang/lib/CIR/Dialect/Transforms/CIRCanonicalize.cpp
    M clang/test/CIR/CodeGen/binop.cpp
    M clang/test/CIR/CodeGen/new.cpp
    M clang/test/CIR/CodeGen/size-of-vla.cpp
    M clang/test/CIR/CodeGen/throws.cpp
    M clang/test/CIR/CodeGen/vla.c
    A clang/test/CIR/Transforms/binop-traits.cir

  Log Message:
  -----------
  [CIR] Add Commutative/Idempotent traits to binary ops

Add missing MLIR traits to CIR binary operations, matching the arith
dialect conventions:

- AndOp, OrOp: Commutative, Idempotent (fixes FIXME)
- AddOp, MulOp, XorOp, MaxOp: Commutative

Add these ops to the CIRCanonicalize pass op list so trait-based
folding is exercised by applyOpPatternsGreedily.

Update testFloatingPointBinOps in binop.cpp to use computed values,
preventing DCE of the now-canonicalized ops.


  Commit: 8f32ff468b5b8b0f958c1e7e70cd14a6ac722ffa
      https://github.com/llvm/llvm-project/commit/8f32ff468b5b8b0f958c1e7e70cd14a6ac722ffa
  Author: xlauko <xlauko at mail.muni.cz>
  Date:   2026-03-08 (Sun, 08 Mar 2026)

  Changed paths:
    M clang/include/clang/CIR/Dialect/IR/CIROps.td
    M clang/lib/CIR/Dialect/Transforms/CIRCanonicalize.cpp
    M clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
    A clang/test/CIR/Lowering/binop-int-vector.cir
    M clang/test/CIR/Lowering/binop-signed-int.cir
    M clang/test/CIR/Lowering/binop-unsigned-int.cir
    A clang/test/CIR/Transforms/max-min-idempotent.cir

  Log Message:
  -----------
  [CIR] Add cir.min op and refactor cir.max lowering

Add cir.min operation for integer minimum computation. Refactor cir.max
lowering into a shared lowerMinMaxOp template reused by both ops. Includes
lowering tests for signed, unsigned, and vector types, plus canonicalization
tests.


Compare: https://github.com/llvm/llvm-project/compare/56207698bc19%5E...8f32ff468b5b

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