• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -newgvn -S | FileCheck %s
3
4define i32 @test1(i32 %arg) {
5; CHECK-LABEL: @test1(
6; CHECK-NEXT:    [[CMP:%.*]] = icmp sge i32 [[ARG:%.*]], 5
7; CHECK-NEXT:    call void @llvm.assume(i1 [[CMP]])
8; CHECK-NEXT:    ret i32 [[ARG]]
9;
10  %cmp = icmp sge i32 %arg, 5
11  call void @llvm.assume(i1 %cmp)
12  ret i32 %arg
13}
14
15define i32 @test2(i32 %arg, i1 %b) {
16; CHECK-LABEL: @test2(
17; CHECK-NEXT:    br label [[BB:%.*]]
18; CHECK:       bb:
19; CHECK-NEXT:    [[A:%.*]] = phi i32 [ 1, [[TMP0:%.*]] ], [ 2, [[BB]] ]
20; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[ARG:%.*]], [[A]]
21; CHECK-NEXT:    call void @llvm.assume(i1 [[CMP]])
22; CHECK-NEXT:    br i1 [[B:%.*]], label [[BB]], label [[END:%.*]]
23; CHECK:       end:
24; CHECK-NEXT:    ret i32 [[ARG]]
25;
26  br label %bb
27
28bb:
29  %a = phi i32 [ 1, %0 ], [ 2, %bb ]
30  %cmp = icmp eq i32 %arg, %a
31  call void @llvm.assume(i1 %cmp)
32  br i1 %b, label %bb, label %end
33
34end:
35  ret i32 %arg
36}
37
38declare void @llvm.assume(i1 %cond)
39