[PATCH] D143954: [ValueTracking] It is not safe to execute FDIV/FREM speculatively
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 13 15:20:18 PST 2023
craig.topper added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4837
+ case Instruction::FRem: {
+ // x / y is undefined if y == 0.0.
+ const APFloat *V;
----------------
craig.topper wrote:
> I don't think this is correct. x/0.0 is infinity or negative infinity. Unless x is 0.0 in which case it's nan. But in any case its not undefined.
> I don't think this is correct. x/0.0 is infinity or negative infinity. Unless x is 0.0 in which case it's nan. But in any case its not undefined.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4837
+ case Instruction::FRem: {
+ // x / y is undefined if y == 0.0.
+ const APFloat *V;
----------------
craig.topper wrote:
> craig.topper wrote:
> > I don't think this is correct. x/0.0 is infinity or negative infinity. Unless x is 0.0 in which case it's nan. But in any case its not undefined.
> > I don't think this is correct. x/0.0 is infinity or negative infinity. Unless x is 0.0 in which case it's nan. But in any case its not undefined.
>
>
So I don't understand why this patch is needed. There's nothing undefined about fdiv/frem.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143954/new/
https://reviews.llvm.org/D143954
More information about the llvm-commits
mailing list