[llvm-commits] [llvm] r169452 - /llvm/trunk/lib/Analysis/ValueTracking.cpp
Jakub Staszak
kubastaszak at gmail.com
Thu Dec 6 02:28:35 PST 2012
If you change -0.0 into +0.0, what about
fsub -0.0, %x
I think we might get unoptimized code then.
On Thu, Dec 6, 2012 at 9:53 AM, Duncan Sands <baldrick at free.fr> wrote:
> Hi Michael,
>
>
> On 06/12/12 01:07, Michael Ilseman wrote:
>
>> Author: milseman
>> Date: Wed Dec 5 18:07:09 2012
>> New Revision: 169452
>>
>> URL: http://llvm.org/viewvc/llvm-**project?rev=169452&view=rev<http://llvm.org/viewvc/llvm-project?rev=169452&view=rev>
>> Log:
>> Have CannotBeNegativeZero() be aware of the nsz fast-math flag
>>
>
> does nsz mean that if there is a signed zero then the behaviour is
> undefined?
> Or does it mean negative zero can be treated like positive zero, and
> there's no
> need to get the sign of zero right?
>
> It seems to me that your patch pretty much assumes the first case.
> If it's instead the second then I think you would do better to have
> instcombine turn all instances of -0.0 into +0.0.
>
> Ciao, Duncan.
>
>
>
>> Modified:
>> llvm/trunk/lib/Analysis/**ValueTracking.cpp
>>
>> Modified: llvm/trunk/lib/Analysis/**ValueTracking.cpp
>> URL: http://llvm.org/viewvc/llvm-**project/llvm/trunk/lib/**
>> Analysis/ValueTracking.cpp?**rev=169452&r1=169451&r2=**169452&view=diff<http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=169452&r1=169451&r2=169452&view=diff>
>> ==============================**==============================**
>> ==================
>> --- llvm/trunk/lib/Analysis/**ValueTracking.cpp (original)
>> +++ llvm/trunk/lib/Analysis/**ValueTracking.cpp Wed Dec 5 18:07:09 2012
>> @@ -1312,7 +1312,12 @@
>>
>> const Operator *I = dyn_cast<Operator>(V);
>> if (I == 0) return false;
>> -
>> +
>> + // Check if the nsz fast-math flag is set
>> + if (const FPMathOperator *FPO = dyn_cast<FPMathOperator>(I))
>> + if (FPO->hasNoSignedZeros())
>> + return true;
>> +
>> // (add x, 0.0) is guaranteed to return +0.0, not -0.0.
>> if (I->getOpcode() == Instruction::FAdd &&
>> isa<ConstantFP>(I->getOperand(**1)) &&
>>
>>
>> ______________________________**_________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/**mailman/listinfo/llvm-commits<http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
>>
>>
> ______________________________**_________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/**mailman/listinfo/llvm-commits<http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121206/536a665d/attachment.html>
More information about the llvm-commits
mailing list