diff options
author | Bill Wendling <isanbard@gmail.com> | 2010-01-13 23:23:17 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2010-01-13 23:23:17 +0000 |
commit | ad7a5b07a794744e5c29211ea5a7eb97585854e2 (patch) | |
tree | 0cc10c077aeb4d81ce6c410f623a881dd6c75f0a /llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp | |
parent | e8c8cd2a58b609b34359623322d9923737bd64c7 (diff) | |
download | bcm5719-llvm-ad7a5b07a794744e5c29211ea5a7eb97585854e2.tar.gz bcm5719-llvm-ad7a5b07a794744e5c29211ea5a7eb97585854e2.zip |
When the visitSub method was split into visitSub and visitFSub, this xform was
added to the FSub version. However, the original version of this xform guarded
against doing this for floating point (!Op0->getType()->isFPOrFPVector()).
This is causing LLVM to perform incorrect xforms for code like:
void func(double *rhi, double *rlo, double xh, double xl, double yh, double yl){
double mh, ml;
double c = 134217729.0;
double up, u1, u2, vp, v1, v2;
up = xh*c;
u1 = (xh - up) + up;
u2 = xh - u1;
vp = yh*c;
v1 = (yh - vp) + vp;
v2 = yh - v1;
mh = xh*yh;
ml = (((u1*v1 - mh) + (u1*v2)) + (u2*v1)) + (u2*v2);
ml += xh*yl + xl*yh;
*rhi = mh + ml;
*rlo = (mh - (*rhi)) + ml;
}
The last line was optimized away, but rl is intended to be the difference
between the infinitely precise result of mh + ml and after it has been rounded
to double precision.
llvm-svn: 93369
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp index c8556ea01d8..4891ff00e7b 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp @@ -736,16 +736,5 @@ Instruction *InstCombiner::visitFSub(BinaryOperator &I) { if (Value *V = dyn_castFNegVal(Op1)) return BinaryOperator::CreateFAdd(Op0, V); - if (BinaryOperator *Op1I = dyn_cast<BinaryOperator>(Op1)) { - if (Op1I->getOpcode() == Instruction::FAdd) { - if (Op1I->getOperand(0) == Op0) // X-(X+Y) == -Y - return BinaryOperator::CreateFNeg(Op1I->getOperand(1), - I.getName()); - else if (Op1I->getOperand(1) == Op0) // X-(Y+X) == -Y - return BinaryOperator::CreateFNeg(Op1I->getOperand(0), - I.getName()); - } - } - return 0; } |