[PATCH] use -0.0 when creating an fneg instruction
Sanjay Patel
spatel at rotateright.com
Fri Dec 19 08:45:02 PST 2014
REPOSITORY
rL LLVM
http://reviews.llvm.org/D6723
Files:
llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/trunk/test/Transforms/InstCombine/fast-math.ll
Index: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
===================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
@@ -759,7 +759,7 @@
}
Value *FAddCombine::createFNeg(Value *V) {
- Value *Zero = cast<Value>(ConstantFP::get(V->getType(), 0.0));
+ Value *Zero = cast<Value>(ConstantFP::getZeroValueForNegation(V->getType()));
Value *NewV = createFSub(Zero, V);
if (Instruction *I = dyn_cast<Instruction>(NewV))
createInstPostProc(I, true); // fneg's don't receive instruction numbers.
Index: llvm/trunk/test/Transforms/InstCombine/fast-math.ll
===================================================================
--- llvm/trunk/test/Transforms/InstCombine/fast-math.ll
+++ llvm/trunk/test/Transforms/InstCombine/fast-math.ll
@@ -93,7 +93,7 @@
ret float %t3
; CHECK-LABEL: @fold9(
-; CHECK: fsub fast float 0.000000e+00, %f2
+; CHECK: fsub fast float -0.000000e+00, %f2
}
; Let C3 = C1 + C2. (f1 + C1) + (f2 + C2) => (f1 + f2) + C3 instead of
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6723.17496.patch
Type: text/x-patch
Size: 1115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141219/2fb78107/attachment.bin>
More information about the llvm-commits
mailing list