; RUN: FileCheck -implicit-check-not=uninteresting --check-prefixes=ALL,CHECK-NOCALL %s < %t
-declare i8* @llvm.sponentry.p0i8()
+declare ptr @llvm.sponentry.p0()
declare i8 @uninteresting()
-; ALL-LABEL: define i8* @interesting(
-define i8* @interesting() {
+; ALL-LABEL: define ptr @interesting(
+define ptr @interesting() {
entry:
- ; CHECK-INTERESTINGNESS: call i8
+ ; CHECK-INTERESTINGNESS: call ptr
; CHECK-NOCALL-NOT: call i8
- ; CHECK-FINAL: %call = call i8* @llvm.sponentry.p0i8()
- ; CHECK-FINAL-NEXT: ret i8* %call
- %call = call i8* @llvm.sponentry.p0i8()
+ ; CHECK-FINAL: %call = call ptr @llvm.sponentry.p0()
+ ; CHECK-FINAL-NEXT: ret ptr %call
+ %call = call ptr @llvm.sponentry.p0()
call i8 @uninteresting()
- ret i8* %call
+ ret ptr %call
}
; RUN: llvm-reduce %s -o %t --delta-passes=operands-skip --test FileCheck --test-arg %s --test-arg --match-full-lines --test-arg --check-prefix=INTERESTING --test-arg --input-file
; RUN: FileCheck %s --input-file %t --check-prefixes=REDUCED
-; INTERESTING: store i32 43, i32* {{(%imm|%indirect)}}, align 4
-; REDUCED: store i32 43, i32* %imm, align 4
+; INTERESTING: store i32 43, ptr {{(%imm|%indirect)}}, align 4
+; REDUCED: store i32 43, ptr %imm, align 4
-; INTERESTING: store i32 44, i32* {{(%imm|%indirect|%phi)}}, align 4
-; REDUCED: store i32 44, i32* %phi, align 4
+; INTERESTING: store i32 44, ptr {{(%imm|%indirect|%phi)}}, align 4
+; REDUCED: store i32 44, ptr %phi, align 4
-; INTERESTING: store i32 45, i32* {{(%imm|%indirect|%phi|%val)}}, align 4
-; REDUCED: store i32 45, i32* %val, align 4
+; INTERESTING: store i32 45, ptr {{(%imm|%indirect|%phi|%val)}}, align 4
+; REDUCED: store i32 45, ptr %val, align 4
-; INTERESTING: store i32 46, i32* {{(%imm|%indirect|%phi|%val|@Global)}}, align 4
-; REDUCED: store i32 46, i32* @Global, align 4
+; INTERESTING: store i32 46, ptr {{(%imm|%indirect|%phi|%val|@Global)}}, align 4
+; REDUCED: store i32 46, ptr @Global, align 4
-; INTERESTING: store i32 47, i32* {{(%imm|%indirect|%phi|%val|@Global|%arg2)}}, align 4
-; REDUCED: store i32 47, i32* %arg2, align 4
+; INTERESTING: store i32 47, ptr {{(%imm|%indirect|%phi|%val|@Global|%arg2)}}, align 4
+; REDUCED: store i32 47, ptr %arg2, align 4
-; INTERESTING: store i32 48, i32* {{(%imm|%indirect|%phi|%val|@Global|%arg2|%arg1)}}, align 4
-; REDUCED: store i32 48, i32* %arg1, align 4
+; INTERESTING: store i32 48, ptr {{(%imm|%indirect|%phi|%val|@Global|%arg2|%arg1)}}, align 4
+; REDUCED: store i32 48, ptr %arg1, align 4
-; INTERESTING: store i32 49, i32* {{(%imm|%indirect|%phi|%val|@Global|%arg2|%arg1|null)}}, align 4
-; REDUCED: store i32 49, i32* null, align 4
+; INTERESTING: store i32 49, ptr {{(%imm|%indirect|%phi|%val|@Global|%arg2|%arg1|null)}}, align 4
+; REDUCED: store i32 49, ptr null, align 4
-; REDUCED: store i32 50, i32* %arg1, align 4
-; REDUCED: store i32 51, i32* %arg1, align 4
+; REDUCED: store i32 50, ptr %arg1, align 4
+; REDUCED: store i32 51, ptr %arg1, align 4
@Global = global i32 42
-define void @func(i32* %arg1, i32* %arg2) {
+define void @func(ptr %arg1, ptr %arg2) {
entry:
- %val = getelementptr i32, i32* getelementptr (i32, i32* @Global, i32 1), i32 2
+ %val = getelementptr i32, ptr getelementptr (i32, ptr @Global, i32 1), i32 2
br i1 undef, label %branch, label %loop
branch:
- %nondominating1 = getelementptr i32, i32* %val, i32 3
+ %nondominating1 = getelementptr i32, ptr %val, i32 3
br label %loop
loop:
- %phi = phi i32* [ null, %entry ], [ %nondominating1, %branch ], [ %nondominating2, %loop ]
- %imm = getelementptr i32, i32* %phi, i32 4
- %indirect = getelementptr i32, i32* %imm, i32 5
-
- store i32 43, i32* %imm, align 4 ; Don't reduce to %indirect (not "more reduced" than %imm)
- store i32 44, i32* %imm, align 4 ; Reduce to %phi
- store i32 45, i32* %imm, align 4 ; Reduce to %val
- store i32 46, i32* %imm, align 4 ; Reduce to @Global
- store i32 47, i32* %imm, align 4 ; Reduce to %arg1
- store i32 48, i32* %imm, align 4 ; Reduce to %arg2
- store i32 49, i32* %imm, align 4 ; Reduce to null
-
- %nondominating2 = getelementptr i32, i32* %indirect, i32 6
+ %phi = phi ptr [ null, %entry ], [ %nondominating1, %branch ], [ %nondominating2, %loop ]
+ %imm = getelementptr i32, ptr %phi, i32 4
+ %indirect = getelementptr i32, ptr %imm, i32 5
+
+ store i32 43, ptr %imm, align 4 ; Don't reduce to %indirect (not "more reduced" than %imm)
+ store i32 44, ptr %imm, align 4 ; Reduce to %phi
+ store i32 45, ptr %imm, align 4 ; Reduce to %val
+ store i32 46, ptr %imm, align 4 ; Reduce to @Global
+ store i32 47, ptr %imm, align 4 ; Reduce to %arg1
+ store i32 48, ptr %imm, align 4 ; Reduce to %arg2
+ store i32 49, ptr %imm, align 4 ; Reduce to null
+
+ %nondominating2 = getelementptr i32, ptr %indirect, i32 6
br i1 undef, label %loop, label %exit
exit:
- store i32 50, i32* %arg2, align 4 ; Reduce to %arg1 (compactify function arguments)
- store i32 51, i32* %arg1, align 4 ; Don't reduce
+ store i32 50, ptr %arg2, align 4 ; Reduce to %arg1 (compactify function arguments)
+ store i32 51, ptr %arg1, align 4 ; Don't reduce
ret void
}
define void @foo() !dbg !7 {
entry:
%a = alloca i32
- call void @llvm.dbg.declare(metadata i32* %a, metadata !13, metadata !DIExpression()), !dbg !14
+ call void @llvm.dbg.declare(metadata ptr %a, metadata !13, metadata !DIExpression()), !dbg !14
ret void
}
; RUN: llvm-reduce %s -o %t --delta-passes=operands-to-args --test FileCheck --test-arg %s --test-arg --match-full-lines --test-arg --check-prefix=INTERESTING --test-arg --input-file
; RUN: FileCheck %s --input-file %t --check-prefixes=REDUCED,INTERESTING
-; REDUCED-LABEL: define void @func(i32 %k, i32* %Local, i32* %Global, float* %0) {
+; REDUCED-LABEL: define void @func(i32 %k, ptr %Local, ptr %Global) {
; Keep one reference to the original value.
; INTERESTING: %[[LOCAL:Local[0-9]*]] = alloca i32, align 4
-; INTERESTING: store i32 42, i32* %[[LOCAL]], align 4
-; INTERESTING: store i32 42, i32* @Global, align 4
+; INTERESTING: store i32 42, ptr %[[LOCAL]], align 4
+; INTERESTING: store i32 42, ptr @Global, align 4
; Everything else must use the function argument.
-; REDUCED: store i32 21, i32* %Local, align 4
-; REDUCED: store i32 21, i32* %Global, align 4
-; REDUCED: store i32 0, i32* %Local, align 4
-; REDUCED: store i32 0, i32* %Global, align 4
-; REDUCED: store float 0.000000e+00, float* %0, align 4
+; REDUCED: store i32 21, ptr %Local, align 4
+; REDUCED: store i32 21, ptr %Global, align 4
+; REDUCED: store i32 0, ptr %Local, align 4
+; REDUCED: store i32 0, ptr %Global, align 4
+; REDUCED: store float 0.000000e+00, ptr %Global, align 4
; Do not add any arguments for %Keep and @GlobalKeep.
; INTERESTING: %[[KEEP:LocalKeep[0-9]*]] = add i32 %k, 21
-; INTERESTING: store i32 %[[KEEP]], i32* @GlobalKeep, align 4
+; INTERESTING: store i32 %[[KEEP]], ptr @GlobalKeep, align 4
; INTERESTING-LABEL: define void @func_caller() {
-; REDUCED: call void @func(i32 21, i32* null, i32* null, float* null)
+; REDUCED: call void @func(i32 21, ptr null, ptr null)
@Global = global i32 42
entry:
%Local = alloca i32, align 4
- store i32 42, i32* %Local, align 4
- store i32 42, i32* @Global, align 4
+ store i32 42, ptr %Local, align 4
+ store i32 42, ptr @Global, align 4
- store i32 21, i32* %Local, align 4
- store i32 21, i32* @Global, align 4
+ store i32 21, ptr %Local, align 4
+ store i32 21, ptr @Global, align 4
- store i32 0, i32* %Local, align 4
- store i32 0, i32* @Global, align 4
+ store i32 0, ptr %Local, align 4
+ store i32 0, ptr @Global, align 4
- store float 0.000000e+00, float* bitcast (i32* @Global to float*), align 4
+ store float 0.000000e+00, ptr @Global, align 4
%LocalKeep = add i32 %k, 21
- store i32 %LocalKeep, i32* @GlobalKeep, align 4
+ store i32 %LocalKeep, ptr @GlobalKeep, align 4
ret void
}
; Make sure to skip functions with non-direct call users
-declare void @e(i8*)
+declare void @e(ptr)
; INTERESTING-LABEL: define void @g() {
define void @g() {
- call void @e(i8* bitcast (void (i8**)* @f to i8*))
+ call void @e(ptr @f)
ret void
}
-; INTERESTING-LABEL: define void @f(i8** %a) {
-define void @f(i8** %a) {
- %1 = load i8*, i8** %a
- %2 = bitcast i8* %1 to i32*
+; INTERESTING-LABEL: define void @f(ptr %a) {
+define void @f(ptr %a) {
+ %1 = load ptr, ptr %a
ret void
}
declare void @llvm.foo(metadata)
; CHECK-LABEL: define i32 @main
-define i32 @main(%t* %a, i32 %a2) {
+define i32 @main(ptr %a, i32 %a2) {
; CHECK-LABEL: lb1:
; ONE: inttoptr i16 0
; ZERO: inttoptr i16 0
; CHECK: br label %lb2
lb1:
- %b = getelementptr %t, %t* %a, i32 1, i32 0
- %i1 = inttoptr i16 0 to i8*
- %i2 = inttoptr i16 1 to i8*
- %i3 = inttoptr i16 2 to i8*
- %i4 = inttoptr i16 undef to i8*
- call void @llvm.foo(metadata %t* %a)
+ %b = getelementptr %t, ptr %a, i32 1, i32 0
+ %i1 = inttoptr i16 0 to ptr
+ %i2 = inttoptr i16 1 to ptr
+ %i3 = inttoptr i16 2 to ptr
+ %i4 = inttoptr i16 undef to ptr
+ call void @llvm.foo(metadata ptr %a)
br label %lb2
; CHECK-LABEL: lb2:
@g1 = global [ 4 x i32 ] zeroinitializer
@g2 = global [ 4 x i32 ] zeroinitializer
-@"$a1" = alias void (), void ()* @fn1
-@"$a2" = alias void (), void ()* @fn2
-@"$a3" = alias void (), void ()* @fn3
-@"$a4" = alias void (), void ()* @fn4
+@"$a1" = alias void (), ptr @fn1
+@"$a2" = alias void (), ptr @fn2
+@"$a3" = alias void (), ptr @fn3
+@"$a4" = alias void (), ptr @fn4
-@"$a5" = alias i64, bitcast (i32* getelementptr ([ 4 x i32 ], [ 4 x i32 ]* @g1, i32 0, i32 1) to i64*)
-@"$a6" = alias i64, bitcast (i32* getelementptr ([ 4 x i32 ], [ 4 x i32 ]* @g2, i32 0, i32 1) to i64*)
+@"$a5" = alias i64, getelementptr ([ 4 x i32 ], ptr @g1, i32 0, i32 1)
+@"$a6" = alias i64, getelementptr ([ 4 x i32 ], ptr @g2, i32 0, i32 1)
-@llvm.used = appending global [1 x i8*] [
- i8* bitcast (i64* @"$a5" to i8*)
+@llvm.used = appending global [1 x ptr] [
+ ptr @"$a5"
], section "llvm.metadata"
-@llvm.compiler.used = appending global [1 x i8*] [
- i8* bitcast (i64* @"$a6" to i8*)
+@llvm.compiler.used = appending global [1 x ptr] [
+ ptr @"$a6"
], section "llvm.metadata"
define void @fn1() {
; RUN: llvm-reduce --delta-passes=arguments --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
; RUN: FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s --input-file %t
-%struct.foo = type { %struct.foo*, i32, i32, i8* }
+%struct.foo = type { ptr, i32, i32, ptr }
define dso_local void @bar() {
entry:
; CHECK-INTERESTINGNESS: call void @interesting(
- ; CHECK-FINAL: call void @interesting(%struct.foo* null)
- call void @interesting(i32 0, i8* null, %struct.foo* null, i8* null, i64 0)
+ ; CHECK-FINAL: call void @interesting(ptr null)
+ call void @interesting(i32 0, ptr null, ptr null, ptr null, i64 0)
ret void
}
; CHECK-ALL: define internal void @interesting
; CHECK-INTERESTINGNESS-SAME: ({{.*}}%interesting{{.*}}) {
-; CHECK-FINAL-SAME: (%struct.foo* %interesting) {
-define internal void @interesting(i32 %uninteresting1, i8* %uninteresting2, %struct.foo* %interesting, i8* %uninteresting3, i64 %uninteresting4) {
+; CHECK-FINAL-SAME: (ptr %interesting) {
+define internal void @interesting(i32 %uninteresting1, ptr %uninteresting2, ptr %interesting, ptr %uninteresting3, i64 %uninteresting4) {
entry:
ret void
}
; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
; RUN: FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s --input-file %t
-declare void @pass(void (i32, i8*, i64*)*)
+declare void @pass(ptr)
define void @bar() {
entry:
; CHECK-INTERESTINGNESS: call void @pass({{.*}}@interesting
- ; CHECK-FINAL: call void @pass(void (i32, i8*, i64*)* bitcast (void (i64*)* @interesting to void (i32, i8*, i64*)*))
- call void @pass(void (i32, i8*, i64*)* @interesting)
+ ; CHECK-FINAL: call void @pass(ptr @interesting)
+ call void @pass(ptr @interesting)
ret void
}
; CHECK-ALL: define internal void @interesting
; CHECK-INTERESTINGNESS-SAME: ({{.*}}%interesting{{.*}}) {
-; CHECK-FINAL-SAME: (i64* %interesting)
-define internal void @interesting(i32 %uninteresting1, i8* %uninteresting2, i64* %interesting) {
+; CHECK-FINAL-SAME: (ptr %interesting)
+define internal void @interesting(i32 %uninteresting1, ptr %uninteresting2, ptr %interesting) {
entry:
ret void
}
declare void @thrown()
; CHECK-ALL: define void @caller()
-define void @caller() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+define void @caller() personality ptr @__gxx_personality_v0 {
; CHECK-ALL: bb:
bb:
; CHECK-INTERESTINGNESS: label %bb3
to label %bb3 unwind label %bb1
bb1:
- landingpad { i8*, i32 } catch i8* null
+ landingpad { ptr, i32 } catch ptr null
call void @thrown()
br label %bb4
define void @func(i1 %arg) {
; CHECK-ALL: entry:
; CHECK-INTERESTINGNESS: call void @foo({{.*}}blockaddress
-; CHECK-FINAL: call void @foo(i8* blockaddress(@func, %bb5))
+; CHECK-FINAL: call void @foo(ptr blockaddress(@func, %bb5))
entry:
- call void @foo(i8* blockaddress(@func, %bb5))
+ call void @foo(ptr blockaddress(@func, %bb5))
ret void
; CHECK-ALL: bb5:
ret void
}
-declare void @foo(i8*)
+declare void @foo(ptr)
; (Aliasee should be either GlobalValue or ConstantExpr).
; CHECK-INTERESTINGNESS: @alias =
-; CHECK-FINAL: @alias = alias void (i32), bitcast (void ()* @func to void (i32)*)
+; CHECK-FINAL: @alias = alias void (i32), ptr @func
-@alias = alias void (i32), void (i32)* @func
+@alias = alias void (i32), ptr @func
; CHECK-FINAL: @func()
define i32 @main() {
entry:
- %0 = load i32, i32* @uninteresting, align 4
+ %0 = load i32, ptr @uninteresting, align 4
- ; CHECK-INTERESTINGNESS: store i32 {{.*}}, i32* @interesting, align 4
- ; CHECK-FINAL: store i32 0, i32* @interesting, align 4
- store i32 %0, i32* @interesting, align 4
+ ; CHECK-INTERESTINGNESS: store i32 {{.*}}, ptr @interesting, align 4
+ ; CHECK-FINAL: store i32 0, ptr @interesting, align 4
+ store i32 %0, ptr @interesting, align 4
- ; CHECK-INTERESTINGNESS: store i32 {{.*}}, i32* @interesting3, align 4
- ; CHECK-FINAL: store i32 0, i32* @interesting3, align 4
- store i32 %0, i32* @interesting3, align 4
+ ; CHECK-INTERESTINGNESS: store i32 {{.*}}, ptr @interesting3, align 4
+ ; CHECK-FINAL: store i32 0, ptr @interesting3, align 4
+ store i32 %0, ptr @interesting3, align 4
- ; CHECK-ALL: load i32, i32* @interesting, align 4
- %1 = load i32, i32* @interesting, align 4
- store i32 %1, i32* @uninteresting, align 4
+ ; CHECK-ALL: load i32, ptr @interesting, align 4
+ %1 = load i32, ptr @interesting, align 4
+ store i32 %1, ptr @uninteresting, align 4
- ; CHECK-ALL: load i32, i32* @interesting3, align 4
- %2 = load i32, i32* @interesting3, align 4
- store i32 %2, i32* @uninteresting2, align 4
+ ; CHECK-ALL: load i32, ptr @interesting3, align 4
+ %2 = load i32, ptr @interesting3, align 4
+ store i32 %2, ptr @uninteresting2, align 4
- ; CHECK-ALL: store i32 5, i32* @interesting, align 4
- store i32 5, i32* @interesting, align 4
+ ; CHECK-ALL: store i32 5, ptr @interesting, align 4
+ store i32 5, ptr @interesting, align 4
- ; CHECK-ALL: store i32 5, i32* @interesting3, align 4
- store i32 5, i32* @interesting3, align 4
+ ; CHECK-ALL: store i32 5, ptr @interesting3, align 4
+ store i32 5, ptr @interesting3, align 4
ret i32 0
}
%uninteresting1 = alloca i32, align 4
%interesting = alloca i32, align 4
%uninteresting2 = alloca i32, align 4
- store i32 0, i32* %uninteresting1, align 4
- store i32 0, i32* %interesting, align 4
- %0 = load i32, i32* %interesting, align 4
+ store i32 0, ptr %uninteresting1, align 4
+ store i32 0, ptr %interesting, align 4
+ %0 = load i32, ptr %interesting, align 4
%uninteresting3 = add nsw i32 %0, 1
- store i32 %uninteresting3, i32* %interesting, align 4
- %1 = load i32, i32* %interesting, align 4
- store i32 %1, i32* %uninteresting2, align 4
+ store i32 %uninteresting3, ptr %interesting, align 4
+ %1 = load i32, ptr %interesting, align 4
+ store i32 %1, ptr %uninteresting2, align 4
ret i32 0
}
; CHECK-INTERESTINGNESS: define void @caller(
; CHECK-FINAL: define void @caller()
-define void @caller(i32 %arg) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+define void @caller(i32 %arg) personality ptr @__gxx_personality_v0 {
; CHECK-ALL: bb:
bb:
; CHECK-INTERESTINGNESS: %i0 = invoke i32 {{.*}}@maybe_throwing_callee
-; CHECK-FINAL: %i0 = invoke i32 bitcast (i32 ()* @maybe_throwing_callee to i32 (i32)*)
+; CHECK-FINAL: %i0 = invoke i32 @maybe_throwing_callee
; CHECK-ALL: to label %bb3 unwind label %bb1
%i0 = invoke i32 @maybe_throwing_callee(i32 %arg)
to label %bb3 unwind label %bb1
; CHECK-ALL: bb1:
bb1:
-; CHECK-ALL: landingpad { i8*, i32 }
-; CHECK-ALL: catch i8* null
+; CHECK-ALL: landingpad { ptr, i32 }
+; CHECK-ALL: catch ptr null
; CHECK-ALL: call void @thrown()
; CHECK-ALL: br label %bb4
- landingpad { i8*, i32 }
- catch i8* null
+ landingpad { ptr, i32 }
+ catch ptr null
call void @thrown()
br label %bb4
; All exciting stuff must remain in the reduced file.
; EXCITING-DAG: ExcitingGlobal = global i32 0, !md !0
; EXCITING-DAG: define void @ExcitingFunc() !md !0
-; EXCITING-DAG: store i32 0, i32* @ExcitingGlobal, align 4, !md !0
+; EXCITING-DAG: store i32 0, ptr @ExcitingGlobal, align 4, !md !0
; EXCITING-DAG: !ExcitingNamedMD = !{!0}
; Boring stuff's metadata must have been removed.
@BoringGlobal = global i32 0, !md !0
define void @ExcitingFunc() !md !0 {
- store i32 0, i32* @ExcitingGlobal, align 4, !md !0
- store i32 0, i32* @BoringGlobal, align 4, !md !0
+ store i32 0, ptr @ExcitingGlobal, align 4, !md !0
+ store i32 0, ptr @BoringGlobal, align 4, !md !0
ret void
}
@uninteresting2 = global i32 0, align 4
@uninteresting3 = global i32 0, align 4
-declare void @use(i32*, i32*, i32*)
+declare void @use(ptr, ptr, ptr)
; CHECK-LABEL: @interesting()
define void @interesting() {
entry:
- ; CHECK-ALL: call void @use(i32* @uninteresting1, i32* @uninteresting2, i32* @uninteresting3)
- call void @use(i32* @uninteresting1, i32* @uninteresting2, i32* @uninteresting3)
- call void @use(i32* @uninteresting1, i32* @uninteresting2, i32* @uninteresting3)
- call void @use(i32* @uninteresting1, i32* @uninteresting2, i32* @uninteresting3)
+ ; CHECK-ALL: call void @use(ptr @uninteresting1, ptr @uninteresting2, ptr @uninteresting3)
+ call void @use(ptr @uninteresting1, ptr @uninteresting2, ptr @uninteresting3)
+ call void @use(ptr @uninteresting1, ptr @uninteresting2, ptr @uninteresting3)
+ call void @use(ptr @uninteresting1, ptr @uninteresting2, ptr @uninteresting3)
ret void
}
call void @callee()
ret void
}
-define i8* @f() {
- ; CHECK-ALL: ret i8* @g.{{([0-9a-f]{32})}}
- ret i8* @g
+define ptr @f() {
+ ; CHECK-ALL: ret ptr @g.{{([0-9a-f]{32})}}
+ ret ptr @g
}
!0 = !{i32 0, !"typeid"}