[PATCH] D107420: [sema] Disallow __builtin_mul_overflow under special condition.

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 27 12:53:50 PDT 2021


craig.topper added a comment.

In D107420#2969715 <https://reviews.llvm.org/D107420#2969715>, @nickdesaulniers wrote:

> In D107420#2929115 <https://reviews.llvm.org/D107420#2929115>, @craig.topper wrote:
>
>> In D107420#2929039 <https://reviews.llvm.org/D107420#2929039>, @aaron.ballman wrote:
>>
>>> In D107420#2928975 <https://reviews.llvm.org/D107420#2928975>, @craig.topper wrote:
>>>
>>>> I put up a patch for a simple fix for this in the backend. https://reviews.llvm.org/D107581  The generated code is not optimal, but maybe better than frontend workarounds.
>>>
>>> Thanks for putting up the backend fix! That's much better than frontend workarounds.
>>
>> Looks like I may have opened a small can of worms. In 32-bit mode, a __builtin_mul_overflow of _ExtInt(128) producing a signed result generates a call to _muloti4 which neither compiler-rt or libgcc implement in 32-bit mode. In 64-bit mode only compiler-rt implements _muloti4 for x86-64.
>
> I think this is also producing references to __mulodi4 for signed `long long` on 32b targets, see: https://bugs.llvm.org/show_bug.cgi?id=28629.

That's true. I only fixed the case that didn't work with either library.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107420/new/

https://reviews.llvm.org/D107420



More information about the cfe-commits mailing list