1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=dse -S < %s | FileCheck %s
4 @global = external constant i8
8 ; CHECK-NEXT: [[TMP1:%.*]] = call noalias ptr @_Znwm(i64 32)
9 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ugt ptr [[TMP1]], @global
10 ; CHECK-NEXT: call void @llvm.assume(i1 [[TMP2]])
11 ; CHECK-NEXT: ret void
13 %tmp1 = call noalias ptr @_Znwm(i64 32)
14 %tmp2 = icmp ugt ptr %tmp1, @global
15 call void @llvm.assume(i1 %tmp2)
16 store i8 0, ptr %tmp1, align 1
22 ; CHECK-NEXT: [[TMP1:%.*]] = call noalias ptr @_Znwm(i64 32)
23 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ugt ptr [[TMP1]], @global
24 ; CHECK-NEXT: call void @llvm.assume(i1 [[TMP2]])
25 ; CHECK-NEXT: call void @quux(ptr @global)
26 ; CHECK-NEXT: ret void
28 %tmp1 = call noalias ptr @_Znwm(i64 32)
29 %tmp2 = icmp ugt ptr %tmp1, @global
30 call void @llvm.assume(i1 %tmp2)
31 store i8 0, ptr %tmp1, align 1
32 call void @quux(ptr @global)
36 ; FIXME: This is a miscompile
37 define void @pr70547() {
38 ; CHECK-LABEL: @pr70547(
39 ; CHECK-NEXT: [[A:%.*]] = alloca i8, align 1
40 ; CHECK-NEXT: [[CALL:%.*]] = call ptr @quux(ptr [[A]]) #[[ATTR1:[0-9]+]]
41 ; CHECK-NEXT: [[V:%.*]] = load i8, ptr [[CALL]], align 1
42 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[V]], 1
43 ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]])
44 ; CHECK-NEXT: ret void
48 %call = call ptr @quux(ptr %a) memory(none) nounwind willreturn
49 %v = load i8, ptr %call
50 %cmp = icmp ne i8 %v, 1
51 call void @llvm.assume(i1 %cmp)
55 declare ptr @_Znwm(i64)
57 declare void @llvm.assume(i1)
59 declare void @quux(ptr)