blob: fbf2061ff650ad7f0e3147d758c597bc6127cc14 [file] [log] [blame]
Aditya Kumar6a267362019-10-04 22:46:42 +00001; REQUIRES: asserts
2; RUN: opt -S -instsimplify -hotcoldsplit -debug < %s 2>&1 | FileCheck %s
Saleem Abdulrasool082f8952019-09-23 22:23:01 +00003; 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
Aditya Kumar6a267362019-10-04 22:46:42 +000011; CHECK: @f
12; CHECK-LABEL: codeRepl:
13; CHECK-NOT: @llvm.assume
14; CHECK: }
15; CHECK: declare {{.*}}@llvm.assume
16; CHECK: define {{.*}}@f.cold.1(i64 %0)
17; CHECK-LABEL: newFuncRoot:
18; CHECK: %1 = icmp eq i64 %0, 0
19; CHECK: call void @llvm.assume(i1 %1)
20
Saleem Abdulrasool082f8952019-09-23 22:23:01 +000021define void @f() {
22entry:
23 %0 = getelementptr inbounds %a, %a* null, i64 0, i32 1
24 br label %label
25
26label:
27 %1 = bitcast i64* %0 to %b**
28 %2 = load %b*, %b** %1, align 8
29 %3 = getelementptr inbounds %b, %b* %2, i64 undef, i32 0
30 %4 = load i64, i64* %3, align 8
31 %5 = icmp ugt i64 %4, 1
32 br i1 %5, label %if.then, label %if.else
33
34if.then:
35 unreachable
36
37if.else:
38 call void @g(i8* undef)
39 %6 = load i64, i64* undef, align 8
40 %7 = and i64 %6, -16
41 %8 = inttoptr i64 %7 to i8*
42 %9 = icmp eq i64 %4, 0
43 call void @llvm.assume(i1 %9)
44 unreachable
45}
46
47declare void @g(i8*)
48
49declare void @llvm.assume(i1)
50