[PATCH] D118031: [NFC] New test case for BasicAA and memcy/memmove with deopt
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 24 04:53:47 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb4b6d6374e2e: [NFC] New test case for BasicAA and memcy/memmove with deopt (authored by Evgeniy Brevnov <ybrevnov at azul.com>).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118031/new/
https://reviews.llvm.org/D118031
Files:
llvm/test/Analysis/BasicAA/deoptimize.ll
Index: llvm/test/Analysis/BasicAA/deoptimize.ll
===================================================================
--- llvm/test/Analysis/BasicAA/deoptimize.ll
+++ llvm/test/Analysis/BasicAA/deoptimize.ll
@@ -1,7 +1,10 @@
; RUN: opt < %s -basic-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) #0
+ at G1 = external global i32
+
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1)
+declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1)
declare void @llvm.experimental.deoptimize.void(...)
declare void @unknown_but_readonly() readonly
@@ -12,3 +15,39 @@
; CHECK-LABEL: Function: test1:
; CHECK: Just Ref: Ptr: i8* %p <-> call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
}
+
+; By specification calls with deopt bundles reads through all operands and entire heap.
+; Check that global G1 is reported as Ref by memcpy/memmove calls.
+define i32 @test_memcpy_with_deopt() {
+; CHECK-LABEL: Function: test_memcpy_with_deopt:
+; CHECK: Just Mod: Ptr: i8* %A <-> call void @llvm.memcpy.p0i8.p0i8.i64(i8* %A, i8* %B, i64 -1, i1 false) [ "deopt"() ]
+; CHECK: Just Ref: Ptr: i8* %B <-> call void @llvm.memcpy.p0i8.p0i8.i64(i8* %A, i8* %B, i64 -1, i1 false) [ "deopt"() ]
+; CHECK: NoModRef: Ptr: i32* @G1 <-> call void @llvm.memcpy.p0i8.p0i8.i64(i8* %A, i8* %B, i64 -1, i1 false) [ "deopt"() ]
+
+ %A = alloca i8
+ %B = alloca i8
+
+ store i32 2, i32* @G1 ;; Not referenced by semantics of memcpy but still may be read due to "deopt"
+
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %A, i8* %B, i64 -1, i1 false) [ "deopt"() ]
+
+ %C = load i32, i32* @G1
+ ret i32 %C
+}
+
+define i32 @test_memmove_with_deopt() {
+; CHECK-LABEL: Function: test_memmove_with_deopt:
+; CHECK: Just Mod: Ptr: i8* %A <-> call void @llvm.memmove.p0i8.p0i8.i64(i8* %A, i8* %B, i64 -1, i1 false) [ "deopt"() ]
+; CHECK: Just Ref: Ptr: i8* %B <-> call void @llvm.memmove.p0i8.p0i8.i64(i8* %A, i8* %B, i64 -1, i1 false) [ "deopt"() ]
+; CHECK: Both ModRef: Ptr: i32* @G1 <-> call void @llvm.memmove.p0i8.p0i8.i64(i8* %A, i8* %B, i64 -1, i1 false) [ "deopt"() ]
+
+ %A = alloca i8
+ %B = alloca i8
+
+ store i32 2, i32* @G1 ;; Not referenced by semantics of memcpy but still may be read due to "deopt"
+
+ call void @llvm.memmove.p0i8.p0i8.i64(i8* %A, i8* %B, i64 -1, i1 false) [ "deopt"() ]
+
+ %C = load i32, i32* @G1
+ ret i32 %C
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118031.402480.patch
Type: text/x-patch
Size: 2656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220124/5992fd79/attachment.bin>
More information about the llvm-commits
mailing list