[llvm] [MemCpyOpt] Fix the invalid code modification for GEP (PR #68479)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 7 06:22:46 PDT 2023


================
@@ -0,0 +1,39 @@
+; RUN: opt -S -passes=memcpyopt < %s -verify-memoryssa | FileCheck %s
+
+; ModuleID = 'memcpy_invalid_modify.ll'
+source_filename = "memcpy_invalid_modify.ll"
+
+%struct.MaskedType = type { i32, i32 }
+
+ at .str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
+
+declare void @llvm.lifetime.start.p0(i64, i8* nocapture) #0
+declare void @llvm.lifetime.end.p0(i64, i8* nocapture) #0
+declare void @MaskedFunction(%struct.MaskedType*, i32 addrspace(1)*)
+
+define i32 @test_gep_modified(ptr noundef %0, ptr noundef %1) {
+; CHECK-NOT: LLVM ERROR: Function @test_gep_modified changed by MemCpyOptPass without invalidating analyses
----------------
nikic wrote:

This is checked implicitly.

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


More information about the llvm-commits mailing list