[all-commits] [llvm/llvm-project] 71051d: [MemCpyOpt] Fix infinite loop in memset+memcpy fol...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Mon Jul 15 00:41:34 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 71051deff27928cff908ea794e09806eee662801
https://github.com/llvm/llvm-project/commit/71051deff27928cff908ea794e09806eee662801
Author: Nikita Popov <npopov at redhat.com>
Date: 2024-07-15 (Mon, 15 Jul 2024)
Changed paths:
M llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
M llvm/test/Transforms/MemCpyOpt/memcpy-zero-size.ll
M llvm/test/Transforms/MemCpyOpt/memset-memcpy-dbgloc.ll
M llvm/test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll
M llvm/test/Transforms/MemCpyOpt/opaque-ptr.ll
Log Message:
-----------
[MemCpyOpt] Fix infinite loop in memset+memcpy fold (#98638)
For the case where the memcpy size is zero, this transform is a complex
no-op. This can lead to an infinite loop when the size is zero in a way
that BasicAA understands, because it can still understand that dst and
dst + src_size are MustAlias.
I've tried to mitigate this before using the isZeroSize() check, but we
can hit cases where InstSimplify doesn't understand that the size is
zero, but BasicAA does.
As such, this bites the bullet and adds an explicit isKnownNonZero()
check to guard against no-op transforms.
Fixes https://github.com/llvm/llvm-project/issues/98610.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list