llvm / clangir

A new (MLIR based) high-level IR for clang.
https://clangir.org
Other
327 stars 86 forks source link

[CIR][CIRGen][LLVMLowering] Add support for checked arithmetic builtins #560

Closed Lancern closed 3 months ago

Lancern commented 3 months ago

This patch adds support for checked arithmetic builtins, including:

This patch adds a new operation cir.checked_arith to represent these builtins. Unlike other CIR operations, this new operation has two result values. One for the possibly truncated result, and the other for a boolean flag that indicates whether the operation has overflowed.

CIRGen and LLVMIR lowering support for the new operation is both included in this PR.

Lancern commented 3 months ago

Rebased onto the latest main.

Lancern commented 3 months ago

Rebased onto the latest main.

Lancern commented 3 months ago

Rebased onto the latest main.