Skip to content

[llvm] Remove br i1 undef from regression tests #116161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions llvm/test/Transforms/HotColdSplit/X86/do-not-split.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ target triple = "x86_64-apple-macosx10.14.0"
; The cold region is too small to split.
; CHECK-LABEL: @foo
; CHECK-NOT: foo.cold.1
define void @foo() {
define void @foo(i1 %arg) {
entry:
br i1 undef, label %if.then, label %if.end
br i1 %arg, label %if.then, label %if.end

if.then: ; preds = %entry
unreachable
Expand All @@ -23,9 +23,9 @@ if.end: ; preds = %entry
; The cold region is still too small to split.
; CHECK-LABEL: @bar
; CHECK-NOT: bar.cold.1
define void @bar() {
define void @bar(i1 %arg) {
entry:
br i1 undef, label %if.then, label %if.end
br i1 %arg, label %if.then, label %if.end

if.then: ; preds = %entry
call void @sink()
Expand All @@ -38,9 +38,9 @@ if.end: ; preds = %entry
; Make sure we don't try to outline the entire function.
; CHECK-LABEL: @fun
; CHECK-NOT: fun.cold.1
define void @fun() {
define void @fun(i1 %arg) {
entry:
br i1 undef, label %if.then, label %if.end
br i1 %arg, label %if.then, label %if.end

if.then: ; preds = %entry
call void @sink()
Expand All @@ -63,9 +63,9 @@ entry:
; Do not split `noinline` functions.
; CHECK-LABEL: @noinline_func
; CHECK-NOT: noinline_func.cold.1
define void @noinline_func() noinline {
define void @noinline_func(i1 %arg) noinline {
entry:
br i1 undef, label %if.then, label %if.end
br i1 %arg, label %if.then, label %if.end

if.then: ; preds = %entry
call void @sink()
Expand All @@ -78,9 +78,9 @@ if.end: ; preds = %entry
; Do not split `alwaysinline` functions.
; CHECK-LABEL: @alwaysinline_func
; CHECK-NOT: alwaysinline_func.cold.1
define void @alwaysinline_func() alwaysinline {
define void @alwaysinline_func(i1 %arg) alwaysinline {
entry:
br i1 undef, label %if.then, label %if.end
br i1 %arg, label %if.then, label %if.end

if.then: ; preds = %entry
call void @sink()
Expand All @@ -105,10 +105,10 @@ loop:
; Don't count debug intrinsics towards the outlining threshold.
; CHECK-LABEL: @dont_count_debug_intrinsics
; CHECK-NOT: dont_count_debug_intrinsics.cold.1
define void @dont_count_debug_intrinsics(i32 %arg1) !dbg !6 {
define void @dont_count_debug_intrinsics(i32 %arg1, i1 %arg) !dbg !6 {
entry:
%var = add i32 0, 0, !dbg !11
br i1 undef, label %if.then, label %if.end
br i1 %arg, label %if.then, label %if.end

if.then: ; preds = %entry
ret void
Expand All @@ -122,9 +122,9 @@ if.end: ; preds = %entry

; CHECK-LABEL: @sanitize_address
; CHECK-NOT: sanitize_address.cold.1
define void @sanitize_address() sanitize_address {
define void @sanitize_address(i1 %arg) sanitize_address {
entry:
br i1 undef, label %if.then, label %if.end
br i1 %arg, label %if.then, label %if.end

if.then: ; preds = %entry
call void @sink()
Expand All @@ -136,9 +136,9 @@ if.end: ; preds = %entry

; CHECK-LABEL: @sanitize_hwaddress
; CHECK-NOT: sanitize_hwaddress.cold.1
define void @sanitize_hwaddress() sanitize_hwaddress {
define void @sanitize_hwaddress(i1 %arg) sanitize_hwaddress {
entry:
br i1 undef, label %if.then, label %if.end
br i1 %arg, label %if.then, label %if.end

if.then: ; preds = %entry
call void @sink()
Expand All @@ -150,9 +150,9 @@ if.end: ; preds = %entry

; CHECK-LABEL: @sanitize_thread
; CHECK-NOT: sanitize_thread.cold.1
define void @sanitize_thread() sanitize_thread {
define void @sanitize_thread(i1 %arg) sanitize_thread {
entry:
br i1 undef, label %if.then, label %if.end
br i1 %arg, label %if.then, label %if.end

if.then: ; preds = %entry
call void @sink()
Expand All @@ -164,9 +164,9 @@ if.end: ; preds = %entry

; CHECK-LABEL: @sanitize_memory
; CHECK-NOT: sanitize_memory.cold.1
define void @sanitize_memory() sanitize_memory {
define void @sanitize_memory(i1 %arg) sanitize_memory {
entry:
br i1 undef, label %if.then, label %if.end
br i1 %arg, label %if.then, label %if.end

if.then: ; preds = %entry
call void @sink()
Expand All @@ -180,9 +180,9 @@ declare void @llvm.trap() cold noreturn

; CHECK-LABEL: @nosanitize_call
; CHECK-NOT: nosanitize_call.cold.1
define void @nosanitize_call() sanitize_memory {
define void @nosanitize_call(i1 %arg) sanitize_memory {
entry:
br i1 undef, label %if.then, label %if.end
br i1 %arg, label %if.then, label %if.end

if.then: ; preds = %entry
call void @llvm.trap(), !nosanitize !2
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/HotColdSplit/addr-taken.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ define void @foo() noreturn cold {
}

; CHECK: define {{.*}} @bar.cold.1{{.*}}#[[outlined_func_attr]]
define void @bar() {
br i1 undef, label %normal, label %exit
define void @bar(i1 %arg) {
br i1 %arg, label %normal, label %exit

normal:
unreachable
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Transforms/HotColdSplit/apply-noreturn-bonus.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

declare void @sink() cold

define void @foo(i32 %arg) {
define void @foo(i32 %arg, i1 %arg2) {
entry:
br i1 undef, label %cold1, label %exit
br i1 %arg2, label %cold1, label %exit

cold1:
; CHECK: Applying bonus for: 4 non-returning terminators
call void @sink()
br i1 undef, label %cold2, label %cold3
br i1 %arg2, label %cold2, label %cold3

cold2:
br label %cold4
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Transforms/HotColdSplit/apply-penalty-for-inputs.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ declare void @sink(ptr, i32, i32) cold

@g = global i32 0

define void @foo(i32 %arg) {
define void @foo(i32 %arg, i1 %arg2) {
%local = load i32, ptr @g
br i1 undef, label %cold, label %exit
br i1 %arg2, label %cold, label %exit

cold:
; CHECK: Applying penalty for splitting: 2
Expand All @@ -21,8 +21,8 @@ exit:
ret void
}

define void @bar(ptr %p1, i32 %p2, i32 %p3) {
br i1 undef, label %cold, label %exit
define void @bar(ptr %p1, i32 %p2, i32 %p3, i1 %arg) {
br i1 %arg, label %cold, label %exit

cold:
; CHECK: Applying penalty for splitting: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ declare void @sink() cold

@g = global i32 0

define i32 @foo(i32 %arg) {
define i32 @foo(i32 %arg, i1 %arg2) {
entry:
br i1 undef, label %cold, label %exit
br i1 %arg2, label %cold, label %exit

cold:
; CHECK: Applying penalty for splitting: 2
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/HotColdSplit/eh-typeid-for.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

; CHECK-LABEL: @fun
; CHECK-NOT: call {{.*}}@fun.cold.1
define void @fun() {
define void @fun(i1 %arg) {
entry:
br i1 undef, label %if.then, label %if.else
br i1 %arg, label %if.then, label %if.else

if.then:
ret void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ target triple = "x86_64-apple-macosx10.14.0"

; CHECK-LABEL: define {{.*}}@fun
; CHECK: call {{.*}}@fun.cold.1(
define void @fun() {
define void @fun(i1 %arg) {
entry:
br i1 undef, label %if.then, label %if.else
br i1 %arg, label %if.then, label %if.else

if.then:
; This will be marked by the inverse DFS on sink-predecesors.
Expand All @@ -17,7 +17,7 @@ sink:
call void @sink()

; Do not allow the forward-DFS on sink-successors to mark the block again.
br i1 undef, label %if.then, label %if.then.exit
br i1 %arg, label %if.then, label %if.then.exit

if.then.exit:
ret void
Expand Down
34 changes: 17 additions & 17 deletions llvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ declare void @use(ptr)
; \ /
; exit
; (lt.end)
define void @only_lifetime_start_is_cold() {
define void @only_lifetime_start_is_cold(i1 %arg) {
; CHECK-LABEL: @only_lifetime_start_is_cold(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[LOCAL1:%.*]] = alloca i256
; CHECK-NEXT: br i1 undef, label [[CODEREPL:%.*]], label [[NO_EXTRACT1:%.*]]
; CHECK-NEXT: [[LOCAL1:%.*]] = alloca i256, align 8
; CHECK-NEXT: br i1 [[ARG:%.*]], label [[CODEREPL:%.*]], label [[NO_EXTRACT1:%.*]]
; CHECK: codeRepl:
; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 -1, ptr [[LOCAL1]])
; CHECK-NEXT: [[TARGETBLOCK:%.*]] = call i1 @only_lifetime_start_is_cold.cold.1(ptr [[LOCAL1]]) #3
; CHECK-NEXT: [[TARGETBLOCK:%.*]] = call i1 @only_lifetime_start_is_cold.cold.1(ptr [[LOCAL1]], i1 [[ARG]]) #[[ATTR3:[0-9]+]]
; CHECK-NEXT: br i1 [[TARGETBLOCK]], label [[NO_EXTRACT1]], label [[EXIT:%.*]]
; CHECK: no-extract1:
; CHECK-NEXT: br label [[EXIT]]
Expand All @@ -51,13 +51,13 @@ define void @only_lifetime_start_is_cold() {
;
entry:
%local1 = alloca i256
br i1 undef, label %extract1, label %no-extract1
br i1 %arg, label %extract1, label %no-extract1

extract1:
; lt.start
call void @llvm.lifetime.start.p0(i64 1, ptr %local1)
call void @cold_use(ptr %local1)
br i1 undef, label %extract2, label %no-extract1
br i1 %arg, label %extract2, label %no-extract1

extract2:
br label %exit
Expand Down Expand Up @@ -92,17 +92,17 @@ exit:
; (lt.end)
; \ /
; exit
define void @only_lifetime_end_is_cold() {
define void @only_lifetime_end_is_cold(i1 %arg) {
; CHECK-LABEL: @only_lifetime_end_is_cold(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[LOCAL1:%.*]] = alloca i256
; CHECK-NEXT: [[LOCAL1:%.*]] = alloca i256, align 8
; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 1, ptr [[LOCAL1]])
; CHECK-NEXT: br i1 undef, label [[NO_EXTRACT1:%.*]], label [[CODEREPL:%.*]]
; CHECK-NEXT: br i1 [[ARG:%.*]], label [[NO_EXTRACT1:%.*]], label [[CODEREPL:%.*]]
; CHECK: no-extract1:
; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 1, ptr [[LOCAL1]])
; CHECK-NEXT: br label [[EXIT:%.*]]
; CHECK: codeRepl:
; CHECK-NEXT: call void @only_lifetime_end_is_cold.cold.1(ptr [[LOCAL1]]) #3
; CHECK-NEXT: call void @only_lifetime_end_is_cold.cold.1(ptr [[LOCAL1]]) #[[ATTR3]]
; CHECK-NEXT: br label [[EXIT]]
; CHECK: exit:
; CHECK-NEXT: ret void
Expand All @@ -111,7 +111,7 @@ entry:
; lt.start
%local1 = alloca i256
call void @llvm.lifetime.start.p0(i64 1, ptr %local1)
br i1 undef, label %no-extract1, label %extract1
br i1 %arg, label %no-extract1, label %extract1

no-extract1:
; lt.end
Expand All @@ -130,17 +130,17 @@ exit:

; In this CFG, splitting will extract the blocks extract{1,2,3}. Lifting the
; lifetime.end marker would be a miscompile.
define void @do_not_lift_lifetime_end() {
define void @do_not_lift_lifetime_end(i1 %arg) {
; CHECK-LABEL: @do_not_lift_lifetime_end(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[LOCAL1:%.*]] = alloca i256
; CHECK-NEXT: [[LOCAL1:%.*]] = alloca i256, align 8
; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 1, ptr [[LOCAL1]])
; CHECK-NEXT: br label [[HEADER:%.*]]
; CHECK: header:
; CHECK-NEXT: call void @use(ptr [[LOCAL1]])
; CHECK-NEXT: br i1 undef, label [[EXIT:%.*]], label [[CODEREPL:%.*]]
; CHECK-NEXT: br i1 [[ARG:%.*]], label [[EXIT:%.*]], label [[CODEREPL:%.*]]
; CHECK: codeRepl:
; CHECK-NEXT: [[TARGETBLOCK:%.*]] = call i1 @do_not_lift_lifetime_end.cold.1(ptr [[LOCAL1]]) #3
; CHECK-NEXT: [[TARGETBLOCK:%.*]] = call i1 @do_not_lift_lifetime_end.cold.1(ptr [[LOCAL1]], i1 [[ARG]]) #[[ATTR3]]
; CHECK-NEXT: br i1 [[TARGETBLOCK]], label [[HEADER]], label [[EXIT]]
; CHECK: exit:
; CHECK-NEXT: ret void
Expand All @@ -155,11 +155,11 @@ header:
; If the lifetime.end marker is lifted, this use becomes dead the second time
; the header block is executed.
call void @use(ptr %local1)
br i1 undef, label %exit, label %extract1
br i1 %arg, label %exit, label %extract1

extract1:
call void @cold_use(ptr %local1)
br i1 undef, label %extract2, label %extract3
br i1 %arg, label %extract2, label %extract3

extract2:
; Backedge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ declare void @use(ptr, ptr)
declare void @use2(ptr, ptr) cold

; CHECK-LABEL: define {{.*}}@foo(
define void @foo() {
define void @foo(i1 %arg) {
entry:
%local1 = alloca ptr
%local2 = alloca ptr
br i1 undef, label %normalPath, label %outlinedPath
br i1 %arg, label %normalPath, label %outlinedPath

normalPath:
call void @use(ptr %local1, ptr %local2)
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/HotColdSplit/minsize.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ target triple = "x86_64-apple-macosx10.14.0"

; CHECK-LABEL: @fun
; CHECK: call void @fun.cold.1
define void @fun() {
define void @fun(i1 %arg) {
entry:
br i1 undef, label %if.then, label %if.else
br i1 %arg, label %if.then, label %if.else

if.then:
ret void
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/HotColdSplit/outline-cold-asm.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ target triple = "x86_64-apple-macosx10.14.0"
; CHECK-LABEL: define {{.*}}@fun.cold.1(
; CHECK: asm ""

define void @fun() {
define void @fun(i1 %arg) {
entry:
br i1 undef, label %if.then, label %if.else
br i1 %arg, label %if.then, label %if.else

if.then:
ret void
Expand Down
Loading
Loading