summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/NewGVN/assumes.ll
blob: 065cc0fb62e08f3b37630c5d5f57cba2d9f6de6b (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
; RUN: opt < %s -newgvn -S | FileCheck %s

; CHECK-LABEL: @test1
; CHECK: ret i32 %arg
define i32 @test1(i32 %arg) {
  %cmp = icmp sge i32 %arg, 5
  call void @llvm.assume(i1 %cmp)
  ret i32 %arg
}

; CHECK-LABEL: @test2
; CHECK: ret i32 %arg
define i32 @test2(i32 %arg, i1 %b) {
  br label %bb

bb:
  %a = phi i32 [ 1, %0 ], [ 2, %bb ]
  %cmp = icmp eq i32 %arg, %a
  call void @llvm.assume(i1 %cmp)
  br i1 %b, label %bb, label %end

end:
  ret i32 %arg
}

declare void @llvm.assume(i1 %cond)
OpenPOWER on IntegriCloud