1 ; RUN: opt -S -codegenprepare -mtriple=x86_64-linux < %s | FileCheck %s
3 ; Ensure that blocks that only contain @llvm.assume are removed completely
4 ; during CodeGenPrepare.
6 ; CHECK-LABEL: @simple(
9 define void @simple(i64 %addr, i1 %assumption) {
10 %cmp1 = icmp eq i64 %addr, 0
11 br i1 %cmp1, label %do_assume, label %end
14 tail call void @llvm.assume(i1 %assumption)
21 ; CHECK-LABEL: @complex_assume(
23 ; CHECK-NEXT: ret void
24 define void @complex_assume(i64 %addr, i1 %assumption_a, i1 %assumption_b,
25 i64 %val_a, i64 %val_b) {
26 %cmp1 = icmp eq i64 %addr, 0
27 br i1 %cmp1, label %do_assume, label %end
30 call void @llvm.assume(i1 %assumption_a)
31 call void @llvm.assume(i1 %assumption_b)
32 %val_xor = xor i64 %val_a, %val_b
33 %val_shifted = lshr i64 %val_xor, 7
34 %assumption_c = trunc i64 %val_shifted to i1
35 call void @llvm.assume(i1 %assumption_c)
36 %assumption_d = call i1 @readonly_func(i64 %val_b)
37 call void @llvm.assume(i1 %assumption_d)
44 declare void @llvm.assume(i1 noundef)
45 declare i1 @readonly_func(i64) nounwind readonly willreturn;