-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CIR][CIRGen][LLVMLowering] Add support for checked arithmetic builtins #560
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Minor nits in the comments.
b481a25
to
5dc8797
Compare
Rebased onto the latest |
5dc8797
to
39c7765
Compare
Rebased onto the latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after a minor nit
c4db6d0
to
e197d4e
Compare
This patch adds CIRGen support for checked arithmetic builtins, including: - `__builtin_add_overflow` and `__builtin_{s|u}add{|l|ll}_overflow`; - `__builtin_sub_overflow` and `__builtin_{s|u}sub{|l|ll}_overflow`; - `__builtin_mul_overflow` and `__builtin_{s|u}mul{|l|ll}_overflow`. This patch adds a new operation `cir.binop.overflow` 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.
39c7765
to
8ef5113
Compare
Rebased onto the latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ns (llvm#560) This patch adds support for checked arithmetic builtins, including: - `__builtin_add_overflow` and `__builtin_{s|u}add{|l|ll}_overflow`; - `__builtin_sub_overflow` and `__builtin_{s|u}sub{|l|ll}_overflow`; - `__builtin_mul_overflow` and `__builtin_{s|u}mul{|l|ll}_overflow`. 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.
…ns (llvm#560) This patch adds support for checked arithmetic builtins, including: - `__builtin_add_overflow` and `__builtin_{s|u}add{|l|ll}_overflow`; - `__builtin_sub_overflow` and `__builtin_{s|u}sub{|l|ll}_overflow`; - `__builtin_mul_overflow` and `__builtin_{s|u}mul{|l|ll}_overflow`. 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.
…ns (llvm#560) This patch adds support for checked arithmetic builtins, including: - `__builtin_add_overflow` and `__builtin_{s|u}add{|l|ll}_overflow`; - `__builtin_sub_overflow` and `__builtin_{s|u}sub{|l|ll}_overflow`; - `__builtin_mul_overflow` and `__builtin_{s|u}mul{|l|ll}_overflow`. 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.
…ns (#560) This patch adds support for checked arithmetic builtins, including: - `__builtin_add_overflow` and `__builtin_{s|u}add{|l|ll}_overflow`; - `__builtin_sub_overflow` and `__builtin_{s|u}sub{|l|ll}_overflow`; - `__builtin_mul_overflow` and `__builtin_{s|u}mul{|l|ll}_overflow`. 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.
This patch adds support for checked arithmetic builtins, including:
__builtin_add_overflow
and__builtin_{s|u}add{|l|ll}_overflow
;__builtin_sub_overflow
and__builtin_{s|u}sub{|l|ll}_overflow
;__builtin_mul_overflow
and__builtin_{s|u}mul{|l|ll}_overflow
.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.