1; REQUIRES: asserts
2; RUN: opt -S -instsimplify -hotcoldsplit -hotcoldsplit-threshold=-1 -debug < %s 2>&1 | FileCheck %s
3; RUN: opt -instcombine -hotcoldsplit -instsimplify %s -o /dev/null
4
5target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
6target triple = "aarch64"
7
8%a = type { i64, i64 }
9%b = type { i64 }
10
11; CHECK: @f
12; CHECK-LABEL: codeRepl:
13; CHECK-NOT: @llvm.assume
14; CHECK: }
15; CHECK: declare {{.*}}@llvm.assume
16; CHECK: define {{.*}}@f.cold.1()
17; CHECK-LABEL: newFuncRoot:
18; CHECK: }
19; CHECK: define {{.*}}@f.cold.2(i64 %0)
20; CHECK-LABEL: newFuncRoot:
21; CHECK: %1 = icmp eq i64 %0, 0
22; CHECK-NOT: call void @llvm.assume
23
24define void @f() {
25entry:
26  %0 = getelementptr inbounds %a, %a* null, i64 0, i32 1
27  br label %label
28
29label:
30  %1 = bitcast i64* %0 to %b**
31  %2 = load %b*, %b** %1, align 8
32  %3 = getelementptr inbounds %b, %b* %2, i64 undef, i32 0
33  %4 = load i64, i64* %3, align 8
34  %5 = icmp ugt i64 %4, 1
35  br i1 %5, label %if.then, label %if.else
36
37if.then:
38  unreachable
39
40if.else:
41  call void @g(i8* undef)
42  %6 = load i64, i64* undef, align 8
43  %7 = and i64 %6, -16
44  %8 = inttoptr i64 %7 to i8*
45  %9 = icmp eq i64 %4, 0
46  call void @llvm.assume(i1 %9)
47  unreachable
48}
49
50declare void @g(i8*)
51
52declare void @llvm.assume(i1)
53
54