[all-commits] [llvm/llvm-project] b41aef: [CIR] Omit nsw/nuw on integer vector binops (#199123)

adams381 via All-commits all-commits at lists.llvm.org
Thu May 28 13:29:58 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b41aef8b809c255814801d658138b98e828012b1
      https://github.com/llvm/llvm-project/commit/b41aef8b809c255814801d658138b98e828012b1
  Author: adams381 <adams at nvidia.com>
  Date:   2026-05-28 (Thu, 28 May 2026)

  Changed paths:
    M clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
    A clang/test/CIR/CodeGen/vector-binop-overflow.cpp

  Log Message:
  -----------
  [CIR] Omit nsw/nuw on integer vector binops (#199123)

CIRGen was attaching `nsw` to `cir.add` on `!cir.vector` integer types
because the signed-overflow path keys off `compType` (the element type,
still `!s32i`), while the verifier only allows `nsw`/`nuw` on scalar
`!cir.int` results.  That mismatch showed up 144 times in the libcxx
CIR sweep on `std::experimental::simd` — `experimental/__simd/vec_ext.h`
increment/decrement (`__data + 1` / `__data - 1`).

Classic CodeGen never enters the signed-overflow block for vector
computation types; CIR now skips the scalar `nsw`/`nuw` path when the
MLIR operand is an integer vector, and uses `getAs<VectorType>()` for
`compType` so typedef-wrapped GCC vectors resolve the element type
correctly.

Regression test `vector-binop-overflow.cpp` checks scalar add still gets
`nsw` and vector add/sub/mul do not (CIR + LLVM + OGCG).



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