llvm.org GIT mirror llvm / f9309e3
[InstSimplify] add a phi test with 1 incoming value; NFC D63489 proposes to change this behavior, but there's no direct -instsimplify test to verify that the transform exists. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363842 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 2 months ago
1 changed file(s) with 32 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
None ; NOTE: Assertions have been autogenerated by update_test_checks.py
0 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
11 ; RUN: opt < %s -instsimplify -S | FileCheck %s
22
33 ; PR12189
44 define i1 @test1(i32 %x) {
55 ; CHECK-LABEL: @test1(
6 ; CHECK: ret i1 %e
6 ; CHECK-NEXT: br i1 true, label [[A:%.*]], label [[B:%.*]]
7 ; CHECK: a:
8 ; CHECK-NEXT: [[AA:%.*]] = or i32 [[X:%.*]], 10
9 ; CHECK-NEXT: br label [[C:%.*]]
10 ; CHECK: b:
11 ; CHECK-NEXT: [[BB:%.*]] = or i32 [[X]], 10
12 ; CHECK-NEXT: br label [[C]]
13 ; CHECK: c:
14 ; CHECK-NEXT: [[CC:%.*]] = phi i32 [ [[BB]], [[B]] ], [ [[AA]], [[A]] ]
15 ; CHECK-NEXT: [[D:%.*]] = urem i32 [[CC]], 2
16 ; CHECK-NEXT: [[E:%.*]] = icmp eq i32 [[D]], 0
17 ; CHECK-NEXT: ret i1 [[E]]
718 ;
819 br i1 true, label %a, label %b
920
2132 %e = icmp eq i32 %d, 0
2233 ret i1 %e
2334 }
35
36 ; D63489 - https://reviews.llvm.org/D63489
37 ; If this single-value phi form needs to be preserved to enable
38 ; further analysis, then -instsimplify should not be running?
39
40 define i32 @lcssa-phi(i32 %x) {
41 ; CHECK-LABEL: @lcssa-phi(
42 ; CHECK-NEXT: entry:
43 ; CHECK-NEXT: br label [[END:%.*]]
44 ; CHECK: end:
45 ; CHECK-NEXT: ret i32 [[X:%.*]]
46 ;
47 entry:
48 br label %end
49
50 end:
51 %counter.lcssa = phi i32 [ %x, %entry ]
52 ret i32 %counter.lcssa
53 }