[PATCH] D41149: [CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

2017-12-15 Thread Phabricator via Phabricator via cfe-commits
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

[PATCH] D41149: [CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

2017-12-15 Thread Vedant Kumar via Phabricator via cfe-commits
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

[PATCH] D41149: [CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

2017-12-15 Thread Eli Friedman via Phabricator via cfe-commits
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

[PATCH] D41149: [CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

2017-12-13 Thread Vedant Kumar via Phabricator via cfe-commits
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

[PATCH] D41149: [CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

2017-12-13 Thread Vedant Kumar via Phabricator via cfe-commits
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 >

[PATCH] D41149: [CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

2017-12-13 Thread Eli Friedman via Phabricator via cfe-commits
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

[PATCH] D41149: [CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

2017-12-12 Thread Vedant Kumar via Phabricator via cfe-commits
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 ===

[PATCH] D41149: [CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

2017-12-12 Thread Vedant Kumar via Phabricator via cfe-commits
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; __