xref: /llvm-project/llvm/test/Transforms/SCCP/apfloat-basictest.ll (revision 8ebb3eac02a926ffa4298c12834c57aefb2e8579)
1; This is a basic correctness check for constant propagation. The fneg
2; instruction should be eliminated.
3
4; RUN: opt < %s -passes=sccp -S | FileCheck %s
5
6define double @test(i1 %B) {
7	br i1 %B, label %BB1, label %BB2
8BB1:
9	%Val = fneg double 42.0
10	br label %BB3
11BB2:
12	br label %BB3
13BB3:
14	%Ret = phi double [%Val, %BB1], [1.0, %BB2]
15	ret double %Ret
16; CHECK-LABEL: @test(
17; CHECK: [[PHI:%.*]] = phi double [ -4.200000e+01, %BB1 ], [ 1.000000e+00, %BB2 ]
18}
19
20define double @test1(i1 %B) {
21        br i1 %B, label %BB1, label %BB2
22BB1:
23        %Div = fdiv double 1.0, 1.0
24        %Val = fneg double %Div
25        br label %BB3
26BB2:
27        br label %BB3
28BB3:
29        %Ret = phi double [%Val, %BB1], [1.0, %BB2]
30        ret double %Ret
31; CHECK-LABEL: @test1(
32; CHECK: [[PHI:%.*]] = phi double [ -1.000000e+00, %BB1 ], [ 1.000000e+00, %BB2 ]
33}
34