-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzilla
Description
| Bugzilla Link | 48769 |
| Resolution | FIXED |
| Resolved on | Sep 07, 2021 11:04 |
| Version | trunk |
| OS | Linux |
| Depends On | #25679 |
| CC | @LebedevRI,@RKSimon,@nickdesaulniers,@nikic,@rotateright |
| Fixed by commit(s) | 13ec913, 35fa7b8 |
Extended Description
int f1(unsigned x, unsigned y)
{
unsigned int r = x * y;
return x && ((int)r / (int)x) != (int)y;
}
This can be optimized to :
int f2(unsigned x, unsigned y)
{
int res;
return __builtin_mul_overflow((int)x, (int)y, &res);
}
This optimization is done by GCC, but not by LLVM.
See also comparison here : https://godbolt.org/z/f9Yv9c
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzilla