This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Handle bzero/memset libcalls globally instead of per target
ClosedPublic

Authored by gchatelet on Jun 8 2022, 2:41 AM.

Diff Detail

Event Timeline

gchatelet created this revision.Jun 8 2022, 2:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2022, 2:41 AM
gchatelet requested review of this revision.Jun 8 2022, 2:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2022, 2:41 AM

Some logic seems to be duplicated here as well. It is called from:

Note sure if we want to keep them.

In general I think this makes a lot more sense.

At first I though that targets that previously did not use bzero (e.g. Arm, SystemZ) would start emitting it. However I had a look at the availability of bzero: it looks like only darwin x86 on MacOSX>10.6 and darwin aarch64 have it, so this looks like a noop.

courbet accepted this revision.Jun 8 2022, 3:47 AM
This revision is now accepted and ready to land.Jun 8 2022, 3:47 AM
courbet requested changes to this revision.Jun 8 2022, 4:43 AM
courbet added inline comments.
llvm/test/CodeGen/AArch64/arm64_32.ll
754

Why is this not a noop ?

This revision now requires changes to proceed.Jun 8 2022, 4:43 AM
courbet added inline comments.Jun 8 2022, 5:09 AM
llvm/test/CodeGen/AArch64/arm64_32.ll
750

can you add a test_memset with a nonzero value for the pattern ?

courbet added inline comments.Jun 8 2022, 5:11 AM
llvm/test/CodeGen/AArch64/arm64_32.ll
750

Wait actually this was tested in arm64-memset-to-bzero.ll which this patch deletes. Why is that ?

gchatelet updated this revision to Diff 435109.Jun 8 2022, 5:11 AM
gchatelet marked an inline comment as done.
  • Fix types for bzero call
  • Revert change in test except branching, tailcall now kicks in
gchatelet updated this revision to Diff 435110.Jun 8 2022, 5:15 AM
gchatelet marked an inline comment as done.
  • Added test for arm64_32 memset
gchatelet added inline comments.Jun 8 2022, 5:20 AM
llvm/test/CodeGen/AArch64/arm64_32.ll
754

The CHECK-DAG: and x0, x0, #0xffffffff should still be tested so I reverted it.

bl is changed into a b because we now propagate tailcall for bzero.

gchatelet added inline comments.Jun 8 2022, 5:39 AM
llvm/test/CodeGen/AArch64/arm64_32.ll
750

You're right it should not be deleted, only trimmed from the 256 constraint tests. I'll revert it.

gchatelet updated this revision to Diff 435119.Jun 8 2022, 6:05 AM
  • Revert test and fix it
gchatelet updated this revision to Diff 435120.Jun 8 2022, 6:05 AM
  • Add newline at EOF
courbet accepted this revision.Jun 8 2022, 6:12 AM
courbet added inline comments.
llvm/test/CodeGen/AArch64/arm64-memset-to-bzero.ll
39–40

I think we can remove this now.

This revision is now accepted and ready to land.Jun 8 2022, 6:12 AM
gchatelet updated this revision to Diff 435125.Jun 8 2022, 6:29 AM
  • Address comments
This revision was landed with ongoing or failed builds.Jun 9 2022, 1:47 AM
This revision was automatically updated to reflect the committed changes.