diff options
author | Shuxin Yang <shuxin.llvm@gmail.com> | 2013-01-09 00:13:41 +0000 |
---|---|---|
committer | Shuxin Yang <shuxin.llvm@gmail.com> | 2013-01-09 00:13:41 +0000 |
commit | f0537ab6815c3b2b7ef4d8cd4779285108fe8a08 (patch) | |
tree | aa324e2f0a74a501a10afe60eaa4b50fa2563d97 /llvm/lib/Transforms | |
parent | 14da440018e0817c243f7d568092facba2bf4952 (diff) | |
download | bcm5719-llvm-f0537ab6815c3b2b7ef4d8cd4779285108fe8a08.tar.gz bcm5719-llvm-f0537ab6815c3b2b7ef4d8cd4779285108fe8a08.zip |
Consider expression "0.0 - X" as the negation of X if
- this expression is explicitly marked no-signed-zero, or
- no-signed-zero of this expression can be derived from some context.
llvm-svn: 171922
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombine.h | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombine.h b/llvm/lib/Transforms/InstCombine/InstCombine.h index 959daa258d8..a36b1e6b9e5 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombine.h +++ b/llvm/lib/Transforms/InstCombine/InstCombine.h @@ -211,7 +211,7 @@ public: private: bool ShouldChangeType(Type *From, Type *To) const; Value *dyn_castNegVal(Value *V) const; - Value *dyn_castFNegVal(Value *V) const; + Value *dyn_castFNegVal(Value *V, bool NoSignedZero=false) const; Type *FindElementAtOffset(Type *Ty, int64_t Offset, SmallVectorImpl<Value*> &NewIndices); Instruction *FoldOpIntoSelect(Instruction &Op, SelectInst *SI); diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 6f24cdd738c..dc7fe5cf6b5 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -516,8 +516,8 @@ Value *InstCombiner::dyn_castNegVal(Value *V) const { // instruction if the LHS is a constant negative zero (which is the 'negate' // form). // -Value *InstCombiner::dyn_castFNegVal(Value *V) const { - if (BinaryOperator::isFNeg(V)) +Value *InstCombiner::dyn_castFNegVal(Value *V, bool IgnoreZeroSign) const { + if (BinaryOperator::isFNeg(V, IgnoreZeroSign)) return BinaryOperator::getFNegArgument(V); // Constants can be considered to be negated values if they can be folded. |