https://llvm.org/bugs/show_bug.cgi?id=24818
Bug ID: 24818 Summary: hoisting expensive ops like FP division is bad for perf Product: libraries Version: trunk Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: Transformation Utilities Assignee: unassignedb...@nondot.org Reporter: spatel+l...@rotateright.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified Test case based on bug 24807: double foo(double a, double b) { return (a > 0.0) ? b/a : 0.0; } If 'a' is always less than zero, then we should never clog up an FPU with a potentially very expensive, non-pipelined division instruction. But we're hoisting that op with 'opt' built from r247615: target triple = "x86_64-apple-macosx10.10.0" define double @foo(double %a, double %b) #0 { entry: %cmp = fcmp ogt double %a, 0.000000e+00 %div = fdiv double %b, %a %cond = select i1 %cmp, double %div, double 0.000000e+00 ret double %cond } This is a relatively recent change; it doesn't happen with the clang shipped with Xcode based on 3.6.0: define double @foo(double %a, double %b) #0 { %1 = fcmp ogt double %a, 0.000000e+00 br i1 %1, label %2, label %4 ; <label>:2 ; preds = %0 %3 = fdiv double %b, %a br label %4 ; <label>:4 ; preds = %0, %2 %5 = phi double [ %3, %2 ], [ 0.000000e+00, %0 ] ret double %5 } -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs