This is an archive of the discontinued LLVM Phabricator instance.

[MipsISelLowering] avoid emitting libcalls to __mulodi4()
ClosedPublic

Authored by nickdesaulniers on Aug 27 2021, 2:10 PM.

Details

Summary

has_builtin(builtin_mul_overflow) returns true for 32b MIPS 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 malta_defconfig 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

Diff Detail

Event Timeline

nickdesaulniers requested review of this revision.Aug 27 2021, 2:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2021, 2:10 PM

Same comments as the ARM version from @craig.topper apply here, too.

  • check 128b as well, mem2reg testcase

Can you return the flag like you did for ARM? Just to make sure we don't elide everything and then the test is a NOOP

rengolin accepted this revision.Aug 27 2021, 3:03 PM

LGTM, thanks!

This revision is now accepted and ready to land.Aug 27 2021, 3:03 PM
This revision was landed with ongoing or failed builds.Aug 27 2021, 3:25 PM
This revision was automatically updated to reflect the committed changes.