This is an archive of the discontinued LLVM Phabricator instance.

[PPCISelLowering] avoid emitting libcalls to __mulodi4()
ClosedPublic

Authored by nickdesaulniers on Aug 30 2021, 12:21 PM.

Details

Summary

Similar to D108842, D108844, and D108926.

__has_builtin(builtin_mul_overflow) returns true for 32b PPC targets,
but Clang is deferring to compiler RT when encountering long long types.
This breaks ppc44x_defconfig + CONFIG_BLK_DEV_NBD=y 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 these 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 30 2021, 12:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 30 2021, 12:21 PM
nemanjai accepted this revision.Aug 31 2021, 2:25 AM

LGTM. Thanks for addressing this for PPC as well.

This revision is now accepted and ready to land.Aug 31 2021, 2:25 AM
This revision was landed with ongoing or failed builds.Aug 31 2021, 11:10 AM
This revision was automatically updated to reflect the committed changes.