[llvm] MemCpyOpt: replace an AA query with MSSA query (PR #108535)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 14 00:47:03 PDT 2024


================
@@ -38,9 +38,8 @@ define void @noaliasdst(ptr %src, ptr noalias %dst) {
 
 define void @destroysrc(ptr %src, ptr %dst) {
 ; CHECK-LABEL: @destroysrc(
-; CHECK-NEXT:    [[TMP1:%.*]] = load [[S:%.*]], ptr [[SRC:%.*]], align 8
-; CHECK-NEXT:    call void @llvm.memset.p0.i64(ptr align 8 [[SRC]], i8 0, i64 16, i1 false)
-; CHECK-NEXT:    store [[S]] [[TMP1]], ptr [[DST:%.*]], align 8
+; CHECK-NEXT:    call void @llvm.memset.p0.i64(ptr align 8 [[SRC:%.*]], i8 0, i64 16, i1 false)
+; CHECK-NEXT:    call void @llvm.memmove.p0.p0.i64(ptr align 8 [[DST:%.*]], ptr align 8 [[SRC]], i64 16, i1 false)
----------------
nikic wrote:

Isn't this a miscompile? Previously this copied the value prior to the memset, now it copies the value after the memset.

https://github.com/llvm/llvm-project/pull/108535


More information about the llvm-commits mailing list