summaryrefslogtreecommitdiff
path: root/llvm/test/Transforms/DeadStoreElimination/assume.ll
blob: aa767664c52de15116c8fb1f6b599ea3201fba55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=dse -S < %s | FileCheck %s

@global = external constant i8

define void @f() {
; CHECK-LABEL: @f(
; CHECK-NEXT:    [[TMP1:%.*]] = call noalias ptr @_Znwm(i64 32)
; CHECK-NEXT:    [[TMP2:%.*]] = icmp ugt ptr [[TMP1]], @global
; CHECK-NEXT:    call void @llvm.assume(i1 [[TMP2]])
; CHECK-NEXT:    ret void
;
  %tmp1 = call noalias ptr @_Znwm(i64 32)
  %tmp2 = icmp ugt ptr %tmp1, @global
  call void @llvm.assume(i1 %tmp2)
  store i8 0, ptr %tmp1, align 1
  ret void
}

define void @f2() {
; CHECK-LABEL: @f2(
; CHECK-NEXT:    [[TMP1:%.*]] = call noalias ptr @_Znwm(i64 32)
; CHECK-NEXT:    [[TMP2:%.*]] = icmp ugt ptr [[TMP1]], @global
; CHECK-NEXT:    call void @llvm.assume(i1 [[TMP2]])
; CHECK-NEXT:    call void @quux(ptr @global)
; CHECK-NEXT:    ret void
;
  %tmp1 = call noalias ptr @_Znwm(i64 32)
  %tmp2 = icmp ugt ptr %tmp1, @global
  call void @llvm.assume(i1 %tmp2)
  store i8 0, ptr %tmp1, align 1
  call void @quux(ptr @global)
  ret void
}

declare ptr @_Znwm(i64)

declare void @llvm.assume(i1)

declare void @quux(ptr)