; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s --check-prefix=REUSE
; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s --check-prefix=REUSE
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.14.0"
@G = external dso_local global i32, align 4
;.
; REUSE: @G = external dso_local global i32, align 4
;.
define void @foo(i32) {
; REUSE-LABEL: @foo(
; REUSE-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP0:%.*]], 0
; REUSE-NEXT: tail call void @_Z10sideeffectv()
; REUSE-NEXT: br i1 [[TMP2]], label [[CODEREPL:%.*]], label [[EXIT:%.*]]
; REUSE: codeRepl:
; REUSE-NEXT: call void @foo.cold.1() #[[ATTR2:[0-9]+]]
; REUSE-NEXT: unreachable
; REUSE: exit:
; REUSE-NEXT: ret void
;
%2 = icmp eq i32 %0, 0
tail call void @_Z10sideeffectv()
br i1 %2, label %sink, label %exit
sink:
tail call void @_Z10sideeffectv()
call void @llvm.trap()
unreachable
exit:
ret void
}
define void @bar(i32) {
; REUSE-LABEL: @bar(
; REUSE-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP0:%.*]], 0
; REUSE-NEXT: tail call void @_Z10sideeffectv()
; REUSE-NEXT: br i1 [[TMP2]], label [[CODEREPL:%.*]], label [[EXIT:%.*]]
; REUSE: codeRepl:
; REUSE-NEXT: call void @bar.cold.1() #[[ATTR2]]
; REUSE-NEXT: unreachable
; REUSE: exit:
; REUSE-NEXT: ret void
;
%2 = icmp eq i32 %0, 0
tail call void @_Z10sideeffectv()
br i1 %2, label %sink, label %exit
sink:
tail call void @_Z10sideeffectv()
call void @llvm.trap()
unreachable
exit:
ret void
}
declare void @llvm.trap() noreturn cold memory(inaccessiblemem: write)
declare void @_Z10sideeffectv()
;.
; REUSE: attributes #[[ATTR0:[0-9]+]] = { cold noreturn nounwind memory(inaccessiblemem: write) }
; REUSE: attributes #[[ATTR1:[0-9]+]] = { cold minsize noreturn }
; REUSE: attributes #[[ATTR2]] = { noinline }
;.