blob: 14baeea4b0b9b65c07446da09eec77c3cf74e307 [file] [log] [blame]
Chris Lattner3d73bce2008-01-03 07:25:26 +00001; The phi should not be eliminated in this case, because the fp op could trap.
Chandler Carruth4177e6f2012-07-02 12:47:22 +00002; RUN: opt < %s -simplifycfg -S | grep "= phi double"
Chris Lattner3d73bce2008-01-03 07:25:26 +00003
4target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
5target triple = "i686-apple-darwin8"
6@G = weak global double 0.000000e+00, align 8 ; <double*> [#uses=2]
7
8define void @test(i32 %X, i32 %Y, double %Z) {
9entry:
10 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
11 %tmp = load double* @G, align 8 ; <double> [#uses=2]
12 %tmp3 = icmp eq i32 %X, %Y ; <i1> [#uses=1]
13 %tmp34 = zext i1 %tmp3 to i8 ; <i8> [#uses=1]
14 %toBool = icmp ne i8 %tmp34, 0 ; <i1> [#uses=1]
15 br i1 %toBool, label %cond_true, label %cond_next
16
17cond_true: ; preds = %entry
Dan Gohmanae3a0be2009-06-04 22:49:04 +000018 %tmp7 = fadd double %tmp, %Z ; <double> [#uses=1]
Chris Lattner3d73bce2008-01-03 07:25:26 +000019 br label %cond_next
20
21cond_next: ; preds = %cond_true, %entry
22 %F.0 = phi double [ %tmp, %entry ], [ %tmp7, %cond_true ] ; <double> [#uses=1]
23 store double %F.0, double* @G, align 8
24 ret void
25}
26