[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:51:37 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;
----------------
Carrot wrote:
> craig.topper wrote:
> > 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.
> I copied it from the following UDiv/URem case. It should be changed to
> // x / y causes exception if y == 0.0.
Exceptions are assumed to be masked in the default FP environment. If exceptions aren't masked we wouldn't be able to speculate any FP instruction not just 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