llvm.org GIT mirror llvm / 3d73bce
don't hoist FP additions into unconditional adds + selects. This could theoretically introduce a trap, but is also a performance issue. This speeds up ptrdist/ks by 8%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45533 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 11 years ago
2 changed file(s) with 28 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
371371 case Instruction::AShr:
372372 case Instruction::ICmp:
373373 case Instruction::FCmp:
374 if (I->getOperand(0)->getType()->isFPOrFPVector())
375 return false; // FP arithmetic might trap.
374376 break; // These are all cheap and non-trapping instructions.
375377 }
376378
0 ; The phi should not be eliminated in this case, because the fp op could trap.
1 ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep {= phi double}
2
3 target 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"
4 target triple = "i686-apple-darwin8"
5 @G = weak global double 0.000000e+00, align 8 ; [#uses=2]
6
7 define void @test(i32 %X, i32 %Y, double %Z) {
8 entry:
9 %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
10 %tmp = load double* @G, align 8 ; [#uses=2]
11 %tmp3 = icmp eq i32 %X, %Y ; [#uses=1]
12 %tmp34 = zext i1 %tmp3 to i8 ; [#uses=1]
13 %toBool = icmp ne i8 %tmp34, 0 ; [#uses=1]
14 br i1 %toBool, label %cond_true, label %cond_next
15
16 cond_true: ; preds = %entry
17 %tmp7 = add double %tmp, %Z ; [#uses=1]
18 br label %cond_next
19
20 cond_next: ; preds = %cond_true, %entry
21 %F.0 = phi double [ %tmp, %entry ], [ %tmp7, %cond_true ] ; [#uses=1]
22 store double %F.0, double* @G, align 8
23 ret void
24 }
25