Skip to content

[GlobalISel] Remove dead code. (NFC) #145811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2025

Conversation

petechou
Copy link
Contributor

LegalizerHelper::lowerMemCpyFamily only execpts G_MEMCPY, G_MEMMOVE, and
G_MMSET.

LegalizerHelper::lowerMemCpyFamily only execpts G_MEMCPY, G_MEMMOVE, and
G_MMSET.
@llvmbot
Copy link
Member

llvmbot commented Jun 25, 2025

@llvm/pr-subscribers-llvm-globalisel

Author: Pete Chou (petechou)

Changes

LegalizerHelper::lowerMemCpyFamily only execpts G_MEMCPY, G_MEMMOVE, and
G_MMSET.


Full diff: https://github.com/llvm/llvm-project/pull/145811.diff

1 Files Affected:

  • (modified) llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp (-4)
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
index 461fc35337eac..b87b029d01632 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -10099,10 +10099,6 @@ LegalizerHelper::lowerMemCpyFamily(MachineInstr &MI, unsigned MaxLen) {
   }
 
   bool IsVolatile = MemOp->isVolatile();
-  if (Opc == TargetOpcode::G_MEMCPY_INLINE)
-    return lowerMemcpyInline(MI, Dst, Src, KnownLen, DstAlign, SrcAlign,
-                             IsVolatile);
-
   // Don't try to optimize volatile.
   if (IsVolatile)
     return UnableToLegalize;

Comment on lines -10102 to -10105
if (Opc == TargetOpcode::G_MEMCPY_INLINE)
return lowerMemcpyInline(MI, Dst, Src, KnownLen, DstAlign, SrcAlign,
IsVolatile);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please help review the pr and merge it if it looks good. Thanks.

The assertion around L10073 should already test no G_MEMCPY_INLINE is expected. Actually, the code looks dead when it's first introduced in a642872, and is still kept in a later refactoring change 36527cb.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lowerMemcpyInline overload is also probably dead

Copy link
Contributor Author

@petechou petechou Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I guess it's not. It's used in LegalizerHelper::lowerMemcpyInline(MachineInstr &MI) which is called by CombinerHelper::tryEmitMemcpyInline(MachineInstr &MI) from target pre-legalizer combiner.

@arsenm arsenm merged commit 13e0640 into llvm:main Jun 26, 2025
9 checks passed
@petechou petechou deleted the dev-gisel-remove-dead-code branch June 26, 2025 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants