diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2015-01-16 03:00:58 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2015-01-16 03:00:58 +0000 |
commit | 590a2700fcc793c9ed7a408afa17f1b59d37473c (patch) | |
tree | d3fed92d378cbc7917745ae69fdb5a90575a1050 /llvm/lib/Transforms/Scalar/Reassociate.cpp | |
parent | bcc57859587b4ad278505db352f55e9473180723 (diff) | |
download | llvm-590a2700fcc793c9ed7a408afa17f1b59d37473c.zip llvm-590a2700fcc793c9ed7a408afa17f1b59d37473c.tar.gz llvm-590a2700fcc793c9ed7a408afa17f1b59d37473c.tar.bz2 |
Fix Reassociate handling of constant in presence of undef float
http://reviews.llvm.org/D6993
llvm-svn: 226245
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index 4e02255..0fd64e3 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -917,10 +917,13 @@ void Reassociate::RewriteExprTree(BinaryOperator *I, /// version of the value is returned, and BI is left pointing at the instruction /// that should be processed next by the reassociation pass. static Value *NegateValue(Value *V, Instruction *BI) { - if (ConstantFP *C = dyn_cast<ConstantFP>(V)) - return ConstantExpr::getFNeg(C); - if (Constant *C = dyn_cast<Constant>(V)) + if (Constant *C = dyn_cast<Constant>(V)) { + if (C->getType()->isFPOrFPVectorTy()) { + return ConstantExpr::getFNeg(C); + } return ConstantExpr::getNeg(C); + } + // We are trying to expose opportunity for reassociation. One of the things // that we want to do to achieve this is to push a negation as deep into an |