[llvm] a42b0ca - SpeculativeExecution: Convert tests to opaque pointers
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 28 05:41:40 PST 2022
Author: Matt Arsenault
Date: 2022-11-28T08:41:31-05:00
New Revision: a42b0ca3b82f18803fc8a3135a13dd75ef77e8d0
URL: https://github.com/llvm/llvm-project/commit/a42b0ca3b82f18803fc8a3135a13dd75ef77e8d0
DIFF: https://github.com/llvm/llvm-project/commit/a42b0ca3b82f18803fc8a3135a13dd75ef77e8d0.diff
LOG: SpeculativeExecution: Convert tests to opaque pointers
Added:
Modified:
llvm/test/Transforms/SpeculativeExecution/PR46267.ll
llvm/test/Transforms/SpeculativeExecution/spec-casts.ll
llvm/test/Transforms/SpeculativeExecution/spec.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SpeculativeExecution/PR46267.ll b/llvm/test/Transforms/SpeculativeExecution/PR46267.ll
index fcf34f3ae4343..98352af721e24 100644
--- a/llvm/test/Transforms/SpeculativeExecution/PR46267.ll
+++ b/llvm/test/Transforms/SpeculativeExecution/PR46267.ll
@@ -1,33 +1,29 @@
; RUN: opt < %s -S -passes='speculative-execution' | FileCheck %s
-%class.B = type { i32 (...)** }
+%class.B = type { ptr }
; Testing that two bitcasts are not hoisted to the first BB
-define i8* @foo(%class.B* readonly %b) {
+define ptr @foo(ptr readonly %b) {
; CHECK-LABEL: foo
; CHECK-LABEL: entry
-; CHECK-NEXT: %i = icmp eq %class.B* %b, null
+; CHECK-NEXT: %i = icmp eq ptr %b, null
; CHECK-NEXT: br i1 %i, label %end, label %notnull
entry:
- %i = icmp eq %class.B* %b, null
+ %i = icmp eq ptr %b, null
br i1 %i, label %end, label %notnull
; CHECK-LABEL: notnull:
-; CHECK-NEXT: %i1 = bitcast %class.B* %b to i32**
-; CHECK: %i3 = bitcast %class.B* %b to i8*
notnull: ; preds = %entry
- %i1 = bitcast %class.B* %b to i32**
- %vtable = load i32*, i32** %i1, align 8
- %i2 = getelementptr inbounds i32, i32* %vtable, i64 -2
- %offset.to.top = load i32, i32* %i2, align 4
- %i3 = bitcast %class.B* %b to i8*
+ %vtable = load ptr, ptr %b, align 8
+ %i2 = getelementptr inbounds i32, ptr %vtable, i64 -2
+ %offset.to.top = load i32, ptr %i2, align 4
%i4 = sext i32 %offset.to.top to i64
- %i5 = getelementptr inbounds i8, i8* %i3, i64 %i4
+ %i5 = getelementptr inbounds i8, ptr %b, i64 %i4
br label %end
end: ; preds = %notnull, %entry
- %i6 = phi i8* [ %i5, %notnull ], [ null, %entry ]
- ret i8* %i6
+ %i6 = phi ptr [ %i5, %notnull ], [ null, %entry ]
+ ret ptr %i6
}
define void @f(i32 %i) {
@@ -41,18 +37,18 @@ land.rhs: ; preds = %entry
; CHECK: land.rhs:
; CHECK-NEXT: call void @llvm.dbg.label
; CHECK-NEXT: %x = alloca i32, align 4
-; CHECK-NEXT: call void @llvm.dbg.addr(metadata i32* %x
+; CHECK-NEXT: call void @llvm.dbg.addr(metadata ptr %x
; CHECK-NEXT: %y = alloca i32, align 4
-; CHECK-NEXT: call void @llvm.dbg.declare(metadata i32* %y
-; CHECK-NEXT: %a0 = load i32, i32* undef, align 1
+; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr %y
+; CHECK-NEXT: %a0 = load i32, ptr undef, align 1
; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %a0
call void @llvm.dbg.label(metadata !11), !dbg !10
%x = alloca i32, align 4
- call void @llvm.dbg.addr(metadata i32* %x, metadata !12, metadata !DIExpression()), !dbg !10
+ call void @llvm.dbg.addr(metadata ptr %x, metadata !12, metadata !DIExpression()), !dbg !10
%y = alloca i32, align 4
- call void @llvm.dbg.declare(metadata i32* %y, metadata !14, metadata !DIExpression()), !dbg !10
+ call void @llvm.dbg.declare(metadata ptr %y, metadata !14, metadata !DIExpression()), !dbg !10
- %a0 = load i32, i32* undef, align 1
+ %a0 = load i32, ptr undef, align 1
call void @llvm.dbg.value(metadata i32 %a0, metadata !9, metadata !DIExpression()), !dbg !10
%a2 = add i32 %i, 0
diff --git a/llvm/test/Transforms/SpeculativeExecution/spec-casts.ll b/llvm/test/Transforms/SpeculativeExecution/spec-casts.ll
index 396f7ab0032cb..c966bed2f2973 100644
--- a/llvm/test/Transforms/SpeculativeExecution/spec-casts.ll
+++ b/llvm/test/Transforms/SpeculativeExecution/spec-casts.ll
@@ -23,7 +23,7 @@ define void @ifThen_ptrtoint() {
br i1 true, label %a, label %b
a:
- %x = ptrtoint i32* undef to i64
+ %x = ptrtoint ptr undef to i64
br label %b
b:
@@ -37,7 +37,7 @@ define void @ifThen_inttoptr() {
br i1 true, label %a, label %b
a:
- %x = inttoptr i64 undef to i32*
+ %x = inttoptr i64 undef to ptr
br label %b
b:
@@ -50,7 +50,7 @@ b:
define void @ifThen_addrspacecast() {
br i1 true, label %a, label %b
a:
- %x = addrspacecast i32* undef to i32 addrspace(1)*
+ %x = addrspacecast ptr undef to ptr addrspace(1)
br label %b
b:
diff --git a/llvm/test/Transforms/SpeculativeExecution/spec.ll b/llvm/test/Transforms/SpeculativeExecution/spec.ll
index 3150e5b2566d1..9f409eb059f43 100644
--- a/llvm/test/Transforms/SpeculativeExecution/spec.ll
+++ b/llvm/test/Transforms/SpeculativeExecution/spec.ll
@@ -108,7 +108,7 @@ define void @doNotHoistPastDef() {
; CHECK: a:
a:
; CHECK: %def = load
- %def = load i32, i32* null
+ %def = load i32, ptr null
; CHECK: %use = add
%use = add i32 %def, 0
br label %b
@@ -124,7 +124,7 @@ define void @nothingToSpeculate() {
; CHECK: a:
a:
; CHECK: %def = load
- %def = load i32, i32* null
+ %def = load i32, ptr null
br label %b
; CHECK: b:
b:
@@ -135,7 +135,7 @@ b:
define void @hoistIfNotPastDef() {
; CHECK-LABEL: @hoistIfNotPastDef(
; CHECK: %x = load
- %x = load i32, i32* null
+ %x = load i32, ptr null
; CHECK: %y = add i32 %x, 1
; CHECK: %z = add i32 %y, 1
; CHECK: br
@@ -181,7 +181,7 @@ define void @tooMuchLeftBehind() {
; CHECK: a:
a:
; CHECK: %x = load
- %x = load i32, i32* null
+ %x = load i32, ptr null
; CHECK: %r1 = add
%r1 = add i32 %x, 1
; CHECK: %r2 = add
More information about the llvm-commits
mailing list