[ARMISelLowering] avoid emitting libcalls to __mulodi4()
authorNick Desaulniers <ndesaulniers@google.com>
Fri, 27 Aug 2021 22:06:08 +0000 (15:06 -0700)
committerNick Desaulniers <ndesaulniers@google.com>
Fri, 27 Aug 2021 22:14:47 +0000 (15:14 -0700)
commit5c91b98c5d45243352bf10262454bcac77cd3fed
treec035730831037157e65d9a879c0020991a7144a1
parent0a7b8cc5dd8efadeef07bf6e4e93c7df2ebe7220
[ARMISelLowering] avoid emitting libcalls to __mulodi4()

__has_builtin(__builtin_mul_overflow) returns true for 32b ARM targets,
but Clang is deferring to compiler RT when encountering `long long`
types. This breaks sanitizer builds of the Linux kernel that are using
__builtin_mul_overflow with these types for these targets.

If the semantics of __has_builtin mean "the compiler resolves these,
always" then we shouldn't conditionally emit a libcall.

This will still need to be worked around in the Linux kernel in order to
continue to support allmodconfig builds of the Linux kernel for this
target with older releases of clang.

Link: https://bugs.llvm.org/show_bug.cgi?id=28629
Link: https://github.com/ClangBuiltLinux/linux/issues/1438
Reviewed By: rengolin

Differential Revision: https://reviews.llvm.org/D108842
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/test/CodeGen/ARM/overflow-intrinsic-optimizations.ll