This revision was automatically updated to reflect the committed changes.
Closed by commit rL320902: [CodeGen] Specialize mixed-sign mul-with-overflow
(fix PR34920) (authored by vedantk, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D41149?vs=126854&id=127220#toc
Repository
vsk marked an inline comment as done.
vsk added a comment.
Thanks for the review!
Comment at: lib/CodeGen/CGBuiltin.cpp:912
+ auto IntMax =
+ llvm::APInt::getMaxValue(ResultInfo.Width).zextOrSelf(Op1Info.Width);
+ llvm::Value *TruncOverflow = CGF.Builder.Crea
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.
LGTM
Comment at: lib/CodeGen/CGBuiltin.cpp:912
+ auto IntMax =
+ llvm::APInt::getMaxValue(ResultInfo.Width).zextOrSelf(Op1Info.Width);
+ llvm::Value *T
vsk updated this revision to Diff 126854.
vsk marked an inline comment as done.
vsk edited the summary of this revision.
vsk added a comment.
- Handle unsigned result types.
- Extend the test driver to validate 54 different combinations of signed,
unsigned, and result types:
https://gist.github
vsk added inline comments.
Comment at: test/CodeGen/builtins-overflow.c:402
+ int result;
+ if (__builtin_mul_overflow(y, x, &result))
+return LongLongErrorCode;
efriedma wrote:
> I think the rules for __builtin_mul_overflow say you have to check whether
>
efriedma added inline comments.
Comment at: test/CodeGen/builtins-overflow.c:402
+ int result;
+ if (__builtin_mul_overflow(y, x, &result))
+return LongLongErrorCode;
I think the rules for __builtin_mul_overflow say you have to check whether the
truncate c
vsk updated this revision to Diff 12.
vsk added a comment.
- Make sure the result can be stored into the result ptr.
https://reviews.llvm.org/D41149
Files:
lib/CodeGen/CGBuiltin.cpp
test/CodeGen/builtins-overflow.c
Index: test/CodeGen/builtins-overflow.c
===
vsk created this revision.
vsk added reviewers: efriedma, rjmccall, dtzWill.
This patch introduces a specialized way to lower overflow-checked
multiplications with mixed-sign operands. This fixes link failures and
ICEs on code like this:
void mul(int64_t a, uint64_t b) {
int64_t res;
__