Skip to content

Commit

Permalink
[CodeExtractor] Convert tests to opaque pointers (NFC)
Browse files Browse the repository at this point in the history
Keeping bitcasts to preserve test behavior.
  • Loading branch information
nikic committed Jan 11, 2023
1 parent bbfa7ef commit 60cdd12
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
28 changes: 14 additions & 14 deletions llvm/test/Transforms/CodeExtractor/PartialInlineAlloca4.ll
@@ -1,49 +1,49 @@
; RUN: opt < %s -passes=partial-inliner -skip-partial-inlining-cost-analysis -S | FileCheck %s
; RUN: opt < %s -passes=partial-inliner -skip-partial-inlining-cost-analysis -S | FileCheck %s

%"class.base" = type { %"struct.base"* }
%"class.base" = type { ptr }
%"struct.base" = type opaque

@g = external local_unnamed_addr global i32, align 4

; CHECK-LABEL: define{{.*}}@caller(
; CHECK: call void @llvm.lifetime.start.p0i8(i64 -1, i8* %tmp.i)
; CHECK-NEXT: call void @callee_unknown_use1.{{.*}}(i8* %tmp.i
; CHECK: call void @llvm.lifetime.start.p0(i64 -1, ptr %tmp.i)
; CHECK-NEXT: call void @callee_unknown_use1.{{.*}}(ptr %tmp.i

define i32 @callee_unknown_use1(i32 %arg) local_unnamed_addr #0 {
; CHECK-LABEL:define{{.*}}@callee_unknown_use1.{{[0-9]}}
; CHECK-NOT: alloca
bb:
%tmp = alloca i8, align 4
%tmp2 = load i32, i32* @g, align 4, !tbaa !2
%tmp2 = load i32, ptr @g, align 4, !tbaa !2
%tmp3 = add nsw i32 %tmp2, 1
%tmp4 = icmp slt i32 %arg, 0
br i1 %tmp4, label %bb6, label %bb5

bb5: ; preds = %bb
call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %tmp) #2
store i32 %tmp3, i32* @g, align 4, !tbaa !2
%tmp11 = bitcast i8* %tmp to i32*
call void @bar(i32* nonnull %tmp11) #2
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %tmp) #2
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tmp) #2
store i32 %tmp3, ptr @g, align 4, !tbaa !2
%tmp11 = bitcast ptr %tmp to ptr
call void @bar(ptr nonnull %tmp11) #2
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tmp) #2
br label %bb6

bb6: ; preds = %bb5, %bb
%tmp7 = phi i32 [ 1, %bb5 ], [ 0, %bb ]
%tmp1 = bitcast i8* %tmp to i32*
%tmp1 = bitcast ptr %tmp to ptr
ret i32 %tmp7
}


; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1

declare void @bar(i32*) local_unnamed_addr #2
declare void @bar2(i32*, i32*) local_unnamed_addr #1
declare void @bar(ptr) local_unnamed_addr #2
declare void @bar2(ptr, ptr) local_unnamed_addr #1


; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define i32 @caller(i32 %arg) local_unnamed_addr #0 {
Expand Down
26 changes: 13 additions & 13 deletions llvm/test/Transforms/CodeExtractor/PartialInlineAlloca5.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -passes=partial-inliner -skip-partial-inlining-cost-analysis -S | FileCheck %s
; RUN: opt < %s -passes=partial-inliner -skip-partial-inlining-cost-analysis -S | FileCheck %s

%"class.base" = type { %"struct.base"* }
%"class.base" = type { ptr }
%"struct.base" = type opaque

@g = external local_unnamed_addr global i32, align 4
Expand All @@ -11,35 +11,35 @@ define i32 @callee_unknown_use2(i32 %arg) local_unnamed_addr #0 {
; CHECK-NOT: alloca
bb:
%tmp = alloca i32, align 4
%tmp1 = bitcast i32* %tmp to i8*
%tmp2 = load i32, i32* @g, align 4, !tbaa !2
%tmp1 = bitcast ptr %tmp to ptr
%tmp2 = load i32, ptr @g, align 4, !tbaa !2
%tmp3 = add nsw i32 %tmp2, 1
%tmp4 = icmp slt i32 %arg, 0
br i1 %tmp4, label %bb6, label %bb5

bb5: ; preds = %bb
call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %tmp1) #2
store i32 %tmp3, i32* %tmp, align 4, !tbaa !2
store i32 %tmp3, i32* @g, align 4, !tbaa !2
call void @bar(i32* nonnull %tmp) #2
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %tmp1) #2
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tmp1) #2
store i32 %tmp3, ptr %tmp, align 4, !tbaa !2
store i32 %tmp3, ptr @g, align 4, !tbaa !2
call void @bar(ptr nonnull %tmp) #2
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tmp1) #2
br label %bb6

bb6: ; preds = %bb5, %bb
%tmp7 = phi i32 [ 1, %bb5 ], [ 0, %bb ]
%tmp10 = bitcast i8* %tmp1 to i32*
%tmp10 = bitcast ptr %tmp1 to ptr
ret i32 %tmp7
}

; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1

declare void @bar(i32*) local_unnamed_addr #2
declare void @bar2(i32*, i32*) local_unnamed_addr #1
declare void @bar(ptr) local_unnamed_addr #2
declare void @bar2(ptr, ptr) local_unnamed_addr #1


; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define i32 @caller(i32 %arg) local_unnamed_addr #0 {
Expand Down
20 changes: 10 additions & 10 deletions llvm/test/Transforms/CodeExtractor/live_shrink_gep.ll
Expand Up @@ -9,28 +9,28 @@
define void @_Z3foov() local_unnamed_addr {
bb:
%tmp = alloca %class.A, align 1
%tmp1 = getelementptr inbounds %class.A, %class.A* %tmp, i64 0, i32 0
call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %tmp1)
%tmp2 = load i32, i32* @cond, align 4, !tbaa !2
%tmp1 = getelementptr inbounds %class.A, ptr %tmp, i64 0, i32 0
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %tmp1)
%tmp2 = load i32, ptr @cond, align 4, !tbaa !2
%tmp3 = icmp eq i32 %tmp2, 0
br i1 %tmp3, label %bb4, label %bb5

bb4: ; preds = %bb
call void @_ZN1A7memfuncEv(%class.A* nonnull %tmp)
call void @_ZN1A7memfuncEv(ptr nonnull %tmp)
br label %bb5

bb5: ; preds = %bb4, %bb
call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %tmp1)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %tmp1)
ret void
}

; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
declare void @llvm.lifetime.start.p0(i64, ptr nocapture)

declare void @_ZN1A7memfuncEv(%class.A*) local_unnamed_addr
declare void @_ZN1A7memfuncEv(ptr) local_unnamed_addr

; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
declare void @llvm.lifetime.end.p0(i64, ptr nocapture)

; Function Attrs: uwtable
define void @_Z3goov() local_unnamed_addr {
Expand All @@ -51,8 +51,8 @@ bb:
; CHECK: newFuncRoot:
; CHECK-NEXT: %tmp = alloca %class.A
; CHECK-NEXT: %tmp1 = getelementptr
; CHECK-NEXT: call void @llvm.lifetime.start.p0i8
; CHECK: call void @llvm.lifetime.end.p0i8
; CHECK-NEXT: call void @llvm.lifetime.start.p0
; CHECK: call void @llvm.lifetime.end.p0
; CHECK-NEXT: br label %bb5.exitStub

!llvm.module.flags = !{!0}
Expand Down

0 comments on commit 60cdd12

Please sign in to comment.