[all-commits] [llvm/llvm-project] 07460b: [MemCpyOpt] Avoid infinite loop in processMemSetMe...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Fri Sep 15 00:10:35 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 07460b66666403fc86e01d3fed6b77c1baf94cb1
https://github.com/llvm/llvm-project/commit/07460b66666403fc86e01d3fed6b77c1baf94cb1
Author: Nikita Popov <npopov at redhat.com>
Date: 2023-09-15 (Fri, 15 Sep 2023)
Changed paths:
M llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
A llvm/test/Transforms/MemCpyOpt/memcpy-zero-size.ll
Log Message:
-----------
[MemCpyOpt] Avoid infinite loop in processMemSetMemCpyDependence (PR54983)
This adds an additional transform to drop zero-size memcpys, also in
the case where the size is only zero after instruction simplification.
The motivation is the case from PR54983 where the size is non-trivially
zero, and processMemSetMemCpyDependence() keeps trying to reduce the
memset size by zero bytes.
This fix it's not really principled. It only works on the premise that
if InstSimplify doesn't realize the size is zero, then AA also won't.
The principled approach would be to instead add a isKnownNonZero()
guard to the processMemSetMemCpyDependence() transform, but I
suspect that would render that optimization mostly useless (at least
it breaks all the existing test coverage -- worth noting that the
constant size case is also handled by DSE, so I think this transform
is primarily about the dynamic size case).
Fixes https://github.com/llvm/llvm-project/issues/54983.
Fixes https://github.com/llvm/llvm-project/issues/64886.
Differential Revision: https://reviews.llvm.org/D124078
More information about the All-commits
mailing list