llvm-project
b41aef8b - [CIR] Omit nsw/nuw on integer vector binops (#199123)

Commit
130 days ago
[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).
Author
Parents
Loading