Page MenuHomePhabricator

[CodeGen] Handle mixed-width ops in mixed-sign mul-with-overflow lowering
ClosedPublic

Authored by vsk on Dec 18 2018, 11:08 AM.

Details

Summary

The special lowering for __builtin_mul_overflow introduced in r320902
fixed an ICE seen when passing mixed-sign operands to the builtin.

This patch extends the special lowering to cover mixed-width, mixed-sign
operands. In a few common scenarios, calls to muloti4 will no longer be
emitted.

This should address the latest comments in PR34920 and work around the
link failure seen in:

https://bugzilla.redhat.com/show_bug.cgi?id=1657544.

Testing:

Diff Detail

Repository
rL LLVM

Event Timeline

vsk created this revision.Dec 18 2018, 11:08 AM

This looks reasonable.

clang/lib/CodeGen/CGBuiltin.cpp
1265 ↗(On Diff #178737)

This is a weird way to express this... could you instead compute the width of the signed operand and the unsigned operand, and compare those?

vsk updated this revision to Diff 178752.Dec 18 2018, 12:06 PM
vsk marked an inline comment as done.
  • Simplify logic per Eli's review feedback.
This revision is now accepted and ready to land.Dec 18 2018, 12:57 PM
This revision was automatically updated to reflect the committed changes.